On Fri, 2010-10-01 at 14:48 -0400, Jerry Feldman wrote:
The entire IP suite is packet driven, TCP, UDP, ICMP. The difference between UDP and TCP is that TCP sets up a connection between the two ends with a guarantee that the entire message (1 or more packets) will be delivered. UDP on the other hand is a datagram where packets are sent to the destination without any checking. A lot of network management protocols, such as SNMP, use UDP and provide end-to-end delivery. That way if a remote host goes down, the application can manage the time outs rather than the packet protocol. What TCP does is to send several packets out up to a window size (usually 7). Each packet is numbered. If the sender detects an error by not receiving the appropriate responses, it may resend packets that fail to arrive. Packets can arrive at the destination out of order, and it is the receiver's responsibility to assemble the packets in the correct order before presenting the data to the application.
Obviously all things that arrive over the Ethernet interface are in discrete packets. I am referring to what the Berkeley socket interface exposes via read/write and recvfrom/sendto. At that level, TCP is a stream of values that bear no correspondence to the packets in which they were delivered over the Ethernet interface. Still, what I was interested in would have be a layer on top of TCP. As Per reminded me, fdopen may provide that layer. I will next determine at what cost I can get this 'service'.
Thanks all for the answers.