Making Protocol Framing Assumptions

 < Day Day Up > 



Framing protocols are those that maintain message boundaries for messages sent through a socket connection. TCP, which is a stream-oriented protocol, maintains no framing on the data sent, which means that data may be accumulated en route to the destination (see Figure 8.1). The application can’t guarantee that the data sent with the send/write function is the same granularity that will be read by the peer. UDP, which is a datagram-oriented protocol, maintains the message boundaries for transmitted data. This means that the unit of data sent in the send/write function is the same unit that is read by the peer (see Figure 8.2).

click to expand
Figure 8.1: Demonstration of the lack of framing in TCP.

click to expand
Figure 8.2: Demonstration of framing in UDP.

The framing characteristic of UDP makes it an ideal protocol for message-based protocols. TCP could be used, but the Application layer would be required to perform the framing. The lesson to be learned here is that unless the protocol supports framing (such as UDP or SCTP), one cannot assume that the granularity of data sent is the same that will be received. As illustrated in Figure 8.1, the blocks of data sent can be accumulated together (within the given MSS) by the sender or receiver TCP layer.



 < Day Day Up > 



BSD Sockets Programming from a Multi-Language Perspective
Network Programming for Microsoft Windows , Second Edition (Microsoft Programming Series)
ISBN: 1584502681
EAN: 2147483647
Year: 2003
Pages: 225
Authors: Jim Ohlund

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net