buffer i/o using read(2) on BSD sockets

Antony A. Courtney antony at lbl-csam.arpa
Mon Mar 12 03:18:40 AEST 1990


In article <11057 at june.cs.washington.edu> ka at cs.washington.edu (Kenneth Almquist) writes:
>aperez at cvbnet.UUCP (Arturo Perez x6739) writes:
>> From article <637 at lot.ACA.MCC.COM>, by ables at 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 at lbl.gov
Advanced Development Group			ucbvax!lbl-csam.arpa!antony
Lawrence Berkeley Laboratory			AACourtney at lbl.gov



More information about the Comp.unix.wizards mailing list