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

Steven M. Bellovin smb at ulysses.att.com
Wed Mar 21 13:16:56 AEST 1990


In article <129 at cvbnetPrime.COM>, aperez at cvbnet.UUCP (Arturo Perez x6739) writes:
> You may or may not recall that I claimed that the buffering on a BSD socket
> is visible to applications and sometimes even users.  For example, here's
> an excerpt from a Sun 3/60 man page for tar(1):


> B	Force tar to perform multiple reads (if necessary)
> 	so as to read exactly enough bytes to fill a block.  This
> 	option exists so that tar can work across the Ethernet,
> 	since pipes and sockets return partial blocks even
> 	when more data is coming.

> That's my best piece of evidence.  Now, you and I may know that it's not 
> strictly necessary to have this option, but there it is.

Without addressing your original claim, Berkeley had no choice on this
one.  The relevant factor is the TCP spec -- TCP has no concept of
records, and does not preserve record boundaries.  Thus, if BSD was
to implement TCP -- which was the purpose of the DARPA grant that
funded much of its development -- and if they were to support tar
across a TCP connection -- and tar format antendates 4.2bsd by several
years -- they had to do something at the application level.  Any
other possible implementation meeting those two constraints would
have similar properties.



More information about the Comp.unix.wizards mailing list