Path: utzoo!censor!geac!torsqnt!jarvis.csri.toronto.edu!mailrus!umich!samsung!zaphod.mps.ohio-state.edu!usc!ucsd!helios.ee.lbl.gov!lbl-csam.arpa!antony From: antony@lbl-csam.arpa (Antony A. Courtney) Newsgroups: comp.unix.wizards Subject: Re: buffer i/o using read(2) on BSD sockets Message-ID: <5046@helios.ee.lbl.gov> Date: 11 Mar 90 17:18:40 GMT References: <637@lot.ACA.MCC.COM> <85@cvbnetPrime.COM> <11057@june.cs.washington.edu> Sender: usenet@helios.ee.lbl.gov Reply-To: antony@lbl-csam.arpa (Antony A. Courtney) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 34 X-Local-Date: 11 Mar 90 09:18:40 PST In article <11057@june.cs.washington.edu> ka@cs.washington.edu (Kenneth Almquist) writes: >aperez@cvbnet.UUCP (Arturo Perez x6739) writes: >> From article <637@lot.ACA.MCC.COM>, by ables@lot.ACA.MCC.COM (King Ables): ||| I've been using read(2) to read data from a socket and am having ||| problems when the buffers get large. I'm hoping someone has run ||| into this before and knows what I am doing wrong. ||| ||| I want to read an arbitrarily large block of data and not have to worry ||| about message boundaries (hence read/write rather than send/recv). || || This is one of my pet peeves about BSD sockets. There is no way || to read an arbitrary amount of data from a socket. You have to be || [...] || Why was such a silly decision made? | |I presume that the idea of having the read system call return a short |count originally appeared in UNIX to deal with terminal input. |[...] |If UNIX did not work this way, [ lots of stuff would break because of lots | reasons]... hmmmm. The thought comes to mind: Why not just add an ioctl() that allows the user-level application to mark the socket for CTRAN i/o (Complete TRANsaction), and when so marked the socket will only return when the number of characters asked for on the read() call is into the buffer? antony -- ******************************************************************************* Antony A. Courtney antony@lbl.gov Advanced Development Group ucbvax!lbl-csam.arpa!antony Lawrence Berkeley Laboratory AACourtney@lbl.gov