Module 11: TCP/IP Transport and Application Layers

¡@

11.1 TCP/IP Transport Layer

11.1.1 Introduction to the TCP/IP transport layer

The primary duties of the transport layer are to transport and regulate the flow of information from a source to a destination, reliably and accurately. End-to-end control and reliability are provided by sliding windows, sequencing numbers, and acknowledgments.

The transport layer establishes a logical connection between two endpoints of a network.

The two primary duties of the transport layer are to provide flow control and reliability.

Some basic transport services are as follows:

¡@

11.1.2 Flow control

As the transport layer sends data segments, it tries to ensure that data is not lost.

Data loss may occur if a host cannot process data as quickly as it arrives. The host is then forced to discard the data.

Flow control ensures that a source host does not overflow the buffers in a destination host.

To provide flow control, TCP allows the source and destination hosts to communicate. The two hosts then establish a data-transfer rate that is agreeable to both.

¡@

11.1.3 Session establishment, maintenance, and termination

Applications can send data segments on a first-come, first-served basis. The segments that arrive first will be taken care of first. These segments can be routed to the same or different destinations.

Multiple applications can share the same transport connection in the OSI reference model. This is referred to as the multiplexing of upper-layer conversations. Numerous simultaneous upper-layer conversations can be multiplexed over a single connection.

Figure shows a typical connection between two systems. The first handshake requests synchronization. The second handshake acknowledge the initial synchronization request, as well as synchronizing connection parameters in the opposite direction. The third handshake segment is an acknowledgment used to inform the destination that both sides agree that a connection has been established. After the connection has been established, data transfer begins.

Congestion can occur for two reasons:

At the end of data transfer, the source host sends a signal that indicates the end of the transmission. The destination host acknowledges the end of transmission and the connection is terminated.

¡@

11.1.4 Three-way handshake

TCP requires a connection to be established before data transfer begins.

The synchronization requires each side to send its own initial sequence number and to receive a confirmation of exchange in an acknowledgment (ACK) from the other side. Each side must receive the initial sequence number from the other side and respond with an ACK. The sequence is as follows:

  1. The sending host (A) initiates a connection by sending a SYN packet to the receiving host (B) indicating its INS = X:

    A - > B SYN, seq of A = X

  2. B receives the packet, records that the seq of A = X, replies with an ACK of X + 1, and indicates that its INS = Y. The ACK of X + 1 means that host B has received all octets up to and including X and is expecting X + 1 next:

    B - > A ACK, seq of A = X, SYN seq of B = Y, ACK = X + 1

  3. A receives the packet from B, it knows that the seq of B = Y, and responds with an ACK of Y + 1, which finalizes the connection process:

    A - > B ACK, seq of B = Y, ACK = Y + 1

This exchange is called the three-way handshake.

¡@

11.1.5 Windowing

Data packets must be delivered to the recipient in the same order in which they were transmitted to have a reliable, connection-oriented data transfer.

The protocol fails if any data packets are lost, damaged, duplicated, or received in a different order.

An easy solution is to have a recipient acknowledge the receipt of each packet before the next packet is sent.

If a sender had to wait for an ACK after each packet was sent, throughput would be low. Therefore, most connection-oriented, reliable protocols allow multiple packets to be sent before an ACK is received. 

The number of data packets the sender can transmit before it receives an ACK is known as the window size, or window.

TCP uses expectational ACKs. This means that the ACK number refers to the next packet that is expected.

Windowing refers to the fact that the window size is negotiated dynamically in the TCP session.

Windowing is a flow-control mechanism.

Windowing requires the source device to receive an ACK from the destination after a certain amount of data is transmitted. The destination host reports a window size to the source host. This window specifies the number of packets that the destination host is prepared to receive. The first packet is the ACK.

With a window size of three, the source device can send three bytes to the destination.

The source device must then wait for an ACK.

     If the destination receives the three bytes, it sends an acknowledgment to the source device, which can now transmit three more bytes.

    If the destination does not receive the three bytes, because of overflowing buffers, it does not send an acknowledgment.

Because the source does not receive an acknowledgment, it knows that the bytes should be retransmitted, and that the transmission rate should be decreased.

Example:

In Figure, the sender sends three packets before it expects an ACK.

If the receiver can handle only two packets, the window drops packet three, specifies three as the next packet, and indicates a new window size of two.

The sender sends the next two packets, but still specifies a window size of three.

This means that the sender will still expect a three-packet ACK from the receiver.

The receiver replies with a request for packet five and again specifies a window size of two.

¡@

11.1.6 Acknowledgment

Reliable delivery guarantees that a stream of data sent from one device is delivered through a data link to another device without duplication or data loss.

Positive acknowledgment with retransmission is one technique that guarantees reliable delivery of data.

Positive acknowledgment requires a recipient to communicate with the source and send back an ACK when the data is received.

The sender also starts a timer when it sends a segment and will retransmit a segment if the timer expires before an ACK arrives.

TCP provides sequencing of segments with a forward reference acknowledgment. Each segment is numbered before transmission. At the destination, TCP reassembles the segments into a complete message. If a sequence number is missing in the series, that segment is retransmitted.

¡@

11.1.7 TCP

TCP is a connection-oriented transport layer protocol that provides reliable full-duplex data transmission.

TCP breaks messages into segments, reassembles them at the destination, and resends anything that is not received.

TCP supplies a virtual circuit between end-user applications.

The following protocols use TCP:

The following are the definitions of the fields in the TCP segment:

¡@

11.1.8 UDP

UDP is a simple protocol that exchanges datagrams without guaranteed delivery. It relies on higher-layer protocols to handle errors and retransmit data.

UDP does not use windows or ACKs. Reliability is provided by application layer protocols. UDP is designed for applications that do not need to put sequences of segments together.

The following protocols use UDP:

The following are the definitions of the fields in the UDP segment:

¡@

11.1.9 TCP and UDP port numbers

Both TCP and UDP use port numbers to pass information to the upper layers.

Port numbers are used to keep track of different conversations that cross the network at the same time.

Application software developers agree to use well-known port numbers that are issued by the Internet Assigned Numbers Authority (IANA).

Port numbers have the following assigned ranges:

End systems use port numbers to select the proper application. The source host dynamically assigns source port numbers. These numbers are always greater than 1023.

¡@

11.2 The Application Layer

11.2.1 Introduction to the TCP/IP application layer

The session, presentation, and application layers of the OSI model are bundled into the application layer of the TCP/IP model. This means that representation, encoding, and dialog control are all handled in the TCP/IP application layer.

This design ensures that the TCP/IP model provides maximum flexibility at the application layer for software developers.

The TCP/IP protocols that support file transfer, e-mail, and remote login are probably the most familiar to users of the Internet.

These protocols include the following applications:

¡@

11.2.2 DNS

11.2.3 FTP and TFTP

TFTP is a connectionless service that uses User Datagram Protocol (UDP).

TFTP is used on the router to transfer configuration files and Cisco IOS images and to transfer files between systems that support TFTP.

TFTP is designed to be small and easy to implement. Therefore, it lacks most of the features of FTP.

TFTP can read or write files to or from a remote server but it cannot list directories and currently has no provisions for user authentication.

It is useful in some LANs because it operates faster than FTP and in a stable environment it works reliably.

11.2.4 HTTP

11.2.5 SMTP

Email servers communicate with each other using the Simple Mail Transfer Protocol (SMTP) to send and receive mail.

11.2.6 SNMP

The Simple Network Management Protocol (SNMP) is an application layer protocol that facilitates the exchange of management information between network devices.

SNMP enables network administrators to manage network performance, find and solve network problems, and plan for network growth.

SNMP uses UDP as its transport layer protocol.

An SNMP managed network consists of the following three key components:

¡@

11.2.7 Telnet