Layer 4, the Transport Layer - Linux

The transport layer in TCP/IP consists of two major protocols. It contains a connection-oriented service reliable service otherwise known as a streaming service provided by the TCP protocol. In addition, TCP/IP includes an individual packet transmission service known as an unreliable or datagram service, which is provided by UDP. Since, historically, it was the function of the data link layer to provide an end-to-end connection-oriented service that includes error checking and recovery, one wonders why there is a need for a reliable delivery method at the transport layer. The reason why TCP/IP evolved this way is that it was designed to be carried over Ethernet and other LAN protocols, which don’t provide a connection- oriented service at the link layer.

User Datagram Protocol

UDP is used where there is a need to send individual packets or datagrams. Each packet is sent as an individual transmission—there is no sequencing of packets and no error detection and recovery mechanism to retry transmitting of lost packets. UDP does not provide a means of ordering the packets. It is possible that packets could arrive at the destination in an order different from the one in which they were sent. Application code using UDP should make no assumptions that packets will arrive in order or arrive at all. It is necessary for applications using UDP to code in their own acknowledgment scheme if reliability is a concern. UDP provides a simple interface to the socket layer above and to the IP layer below. Figure shows the UDP header format.

UDP header.

UDP header.

Transmission Control Protocol

TCP is used where an application requires a reliable or streaming service. Its internal implementation details are almost completely invisible to applications using TCP. To the application program, it looks like a stream of bytes. Most of the well-known and common applications used in the modern connected world use TCP such as FTP and Telnet. The most common of these is the HTTP protocol used byWeb browsers. TCP guarantees that each byte will arrive in sequence, and if an intermediate packet was dropped or errors are detected, the protocol handles retransmission of dropped or erroneous packets. See Figure to see the fields in the TCP header.

TCP header.

TCP header.

TCP is quite complex and is covered much more in depth in, “Sending the Data from the Socket through UDP and TCP,” where we delve into the internals of the Linux implementation of the TCP. However, in this section, we will go over some of the fields in the header to illustrate in general terms the basic function of TCP. In “Broadband Networking Protocols of Yesterday and Today,” we covered the sliding windows algorithm. When using the TCP/IP protocol suite, users must use the TCP transport when they want to have a reliable stream-oriented or connection-oriented delivery. The window size, sequence number, and acknowledgment number fields are used to implement TCP’s version of sliding windows. TCP divides the data stream into segments. The sequence number and acknowledgment number fields are byte pointers that keep track of the position of the segments within the data stream. The flag bits are used to maintain the state of the connection. See Figure for more detail on the TCP header fields used to maintain the connection state.

TCP segments

TCP segments


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Linux Topics