Date: Fri, 15 Nov 1996 10:12:18 PST From: Bill Fenner <fenner@parc.xerox.com> To: Terry Lambert <terry@lambert.org> Cc: fenner@parc.xerox.com (Bill Fenner), scrappy@ki.net, jdp@polstra.com, hackers@freebsd.org Subject: Re: Sockets question... Message-ID: <96Nov15.101231pst.177557@crevenia.parc.xerox.com> In-Reply-To: Your message of "Fri, 15 Nov 96 09:17:03 PST." <199611151717.KAA26280@phaeton.artisoft.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <199611151717.KAA26280@phaeton.artisoft.com> Terry wrote: >Bill Fenner: >> What you need to do is write all your data to the network, >> and not count on it arriving in the same sized chunks as you wrote it. >> But it will all arrive. > >This is (supposedly) what happens *for you* during packet reassembly >on the receiving end. No; what happens for you at the receiving end is that the packets get reassembled into the same *stream* of data as they were at the sender. The sender can buffer small writes into big chunks, or can fragment big writes. If the underlying MTU of the path changes, writes that didn't used to have to be fragmented may now have to be. Packet N can get lost in the network, while packets N+1, N+2, N+3 and N+4 arrive; when the sender retransmits packet N all of a sudden a ton of data "shows up" at the receiver. The receiver's job is *solely* to put those packets back together into the same stream as the sender sent. >From TCP/IP Illustrated, Volume 1, page 224: A stream of 8-bit bytes is exchanged across the TCP connection between the two applications. There are no record markes automatically inserted by TCP. This is what we called a *byte stream service*. If the application on one end writes 10 bytes, followed by a write of 20 bytes, followed by a write of 50 bytes, the application at the other end of the connection cannot tell what size the individual writes were. The other end may read the 80 bytes in four reads of 20 bytes at a time. One end puts a stream of bytes into TCP and the same. identical stream of bytes appears at the other end. Or, if you'd prefer, you could read RFC's 793 and 1122, but they're more verbose than I'd like to quote. Bill
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?96Nov15.101231pst.177557>