TCP and UDP
For most applications running as part of the TCP/IP protocol architecture, the transport layer protocol is TCP. TCP provides a reliable connection for the transfer of data between applications.
In Figure 4, part (a) shows the header format for TCP, which is a minimum of 20 octets, or 160 bits. The Source Port and Destination Port fields identify the applications at the source and destination systems that are using this connection. The Sequence Number, Acknowledgement Number, and Window fields provide flow control and error control. In essence, each segment is sequentially numbered and must be acknowledged by the receiver so that the sender knows that the segment was successfully received. The Window field is passed from one side to the other to indicate how many segments the other side may send before receiving additional permission. Finally, the Checksum is a 16-bit frame check sequence used to detect errors in the TCP segment.
In addition to TCP, another transport-level protocol is in common use as part of the TCP/IP protocol suite: the user datagram protocol (UDP). The UDP provides a connectionless service for application-level procedures. UDP doesn't guarantee delivery, preservation of sequence, or protection against duplication. UDP enables a procedure to send messages to other procedures with a minimum of protocol mechanisms. Some transaction-oriented applications make use of UDP; one example is the Simple Network Management Protocol (SNMP), the standard network-management protocol for TCP/IP networks. Because it's connectionless, UDP has very little to do. Essentially, it adds a port-addressing capability to IP. This is best seen by examining the UDP header, shown in part (b) in Figure 4.
Figure 4 TCP and UDP headers.