| < 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).
Figure 8.1: Demonstration of the lack of framing in TCP.
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 > |
|