Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

CHAPTER 5 Transport Layer

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

CHAPTER 5: TRANSPORT LAYER

Introduction
• The transport layer is a 4th layer from the top.
• The main role of the transport layer is to provide the communication services directly to the
application processes running on different hosts.
• The transport layer provides a logical communication between application processes running on
different hosts. Although the application processes on different hosts are not physically connected,
application processes use the logical communication provided by the transport layer to send the
messages to each other.
• The transport layer protocols are implemented in the end systems but not in the network routers.
• A computer network provides more than one protocol to the network applications. For example,
TCP and UDP are two transport layer protocols that provide a different set of services to the
network layer.
• All transport layer protocols provide multiplexing/demultiplexing service. It also provides other
services such as reliable data transfer, bandwidth guarantees, and delay guarantees.
• Each of the applications in the application layer has the ability to send a message by using TCP or
UDP. The application communicates by using either of these two protocols. Both TCP and UDP
will then communicate with the internet protocol in the internet layer. The applications can read
and write to the transport layer. Therefore, we can say that communication is a two-way process.
Introduction
Transport Service Primitives
• The parameters of primitives are: CONNECT, DATA, DISCONNECT which are used to
establish a connection, to send data, and Disconnect a connection.
• Generally services can be either confirmed or unconfirmed.
• Confirmed service − the connection oriented services are called confirmed services.
• Unconfirmed service − the connectionless services are called unconfirmed services.
Transport Service Primitives
• Connection Oriented Service : The service primitives for the connection oriented
services are as follows −
• Listen: When server is ready to accept request of incoming connection, it simply put this
primitive into action. Listen primitive simply waiting for incoming connection request.
• Connect: This primitive is used to connect the server simply by creating or establishing
connection with waiting peer.
• Accept: This primitive simply accepts incoming connection from the peer.
• Receive: These primitive afterwards block the server. Receive primitive simply waits for
incoming message.
• Send: This primitive is put into action by the client to transmit its request that is followed
by putting receive primitive into action to get the reply. Send primitive simply sends or
transfer the message to the peer.
• Disconnect : This primitive is simply used to terminate or end the connection after which
no one will be able to send any of the message.
Transport Service Primitives
• Connectionless Service: The service primitives for the connectionless services are as
follows −
• Unitdata : Unitdata primitive is simply required to send packet of data or information.
• Facility, Report : This primitive is required for getting details about the performance and
working of the network such xas delivery statistics or report.
Berkeley Sockets
• No class on sockets can be completed without mentioning Berkeley Sockets. Berkeley
sockets is an industry standard Application Programming Interface (API) to create and
use sockets. It was initially used as an API for the Unix operating system and was later
adopted by TCP/IP.
• Berkeley defines 18 standard function names for this purpose. This graphic shows a few
examples.
Berkeley Sockets
• The socket() function creates a socket on the host.
• The bind() function is typically used on the server side and assigns a socket to its local IP
address and port number. Connect() is typically used on the client side. It creates a socket
and also attempts to establish a TCP or UDP connection with a server.
• Send(),recv() and write(),read() are used to send and receive the messages to and from the
socket.
UDP : User Datagram Protocol
• User Datagram Protocol (UDP) is a Transport Layer protocol. UDP is a part of the
Internet Protocol suite, referred to as UDP/IP suite. Unlike TCP, it is an unreliable and
connectionless protocol. So, there is no need to establish a connection prior to data
transfer. The UDP helps to establish low-latency and loss-tolerating connections establish
over the network.The UDP enables process to process communication.
• Though Transmission Control Protocol (TCP) is the dominant transport layer protocol
used with most of the Internet services; provides assured delivery, reliability, and much
more but all these services cost us additional overhead and latency. Here, UDP comes into
the picture. For real-time services like computer gaming, voice or video communication,
live conferences; we need UDP. Since high performance is needed, UDP permits packets
to be dropped instead of processing delayed packets. There is no error checking in UDP,
so it also saves bandwidth.
• User Datagram Protocol (UDP) is more efficient in terms of both latency and bandwidth.
UDP : User Datagram Protocol
• UDP Header :UDP header is an 8-bytes fixed and simple header, while for TCP it may
vary from 20 bytes to 60 bytes. The first 8 Bytes contains all necessary header
information and the remaining part consist of data. UDP port number fields are each 16
bits long, therefore the range for port numbers is defined from 0 to 65535; port number 0
is reserved. Port numbers help to distinguish different user requests or processes
• Source Port: Source Port is a 2 Byte long field used to identify the port number of the
source.
• Destination Port: It is a 2 Byte long field, used to identify the port of the destined packet.
• Length: Length is the length of UDP including the header and the data. It is a 16-bits
field.
• Checksum: Checksum is 2 Bytes long field. It is the 16-bit one’s complement of the one’s
complement sum of the UDP header, the pseudo-header of information from the IP
header, and the data, padded with zero octets at the end (if necessary) to make a multiple
of two octets.
TCP : Transmission Control Protocol
• TCP stands for Transmission Control Protocol. It is a transport layer protocol that
facilitates the transmission of packets from source to destination. It is a connection-
oriented protocol that means it establishes the connection prior to the communication that
occurs between the computing devices in a network. This protocol is used with an IP
protocol, so together, they are referred to as a TCP/IP.
• The main functionality of the TCP is to take the data from the application layer. Then it
divides the data into a several packets, provides numbering to these packets, and finally
transmits these packets to the destination. The TCP, on the other side, will reassemble the
packets and transmits them to the application layer. As we know that TCP is a connection-
oriented protocol, so the connection will remain established until the communication is
not completed between the sender and the receiver.
TCP : Transmission Control Protocol
Working of TCP
In TCP, the connection is established by using three-way handshaking. The client sends the
segment with its sequence number. The server, in return, sends its segment with its own
sequence number as well as the acknowledgement sequence, which is one more than the
client sequence number. When the client receives the acknowledgment of its segment, then
it sends the acknowledgment to the server. In this way, the connection is established
between the client and the server.
TCP State Transition
• TCP/IP State Transition Diagram (RFC793)
• A connection progresses through a series of states during its lifetime. The states are: LISTEN, SYN-SENT,
SYNRECEIVED, ESTABLISHED, FIN-WAIT-1, FIN-WAIT-2, CLOSE-WAIT, CLOSING, LAST-ACK,
TIME-WAIT, and
• the fictional state CLOSED. CLOSED is fictional because it represents the state when there is no TCB, and
• therefore, no connection. Briefly the meanings of the states are:
• LISTEN represents waiting for a connection request from any remote TCP and port.
• SYN-SENT represents waiting for a matching connection request after having sent a connection request.
• SYN-RECEIVED represents waiting for a confirming connection request acknowledgment after having both
• received and sent a connection request.
• ESTABLISHED represents an open connection, data received can be delivered to the user. The normal state
• for the data transfer phase of the connection.
TCP State Transition
• FIN-WAIT-2 represents waiting for a connection termination request from the remote TCP.
• CLOSE-WAIT represents waiting for a connection termination request from the local user.
• CLOSING represents waiting for a connection termination request acknowledgment from the remote
• TCP.
• LAST-ACK represents waiting for an acknowledgment of the connection termination request previously
• sent to the remote TCP (which includes an acknowledgment of its connection termination
• request).
• TIME-WAIT represents waiting for enough time to pass to be sure the remote TCP received the
• acknowledgment of its connection termination request.
• CLOSED represents no connection state at all.
• A TCP connection progresses from one state to another in response to events. The events are the user calls,
• OPEN, SEND, RECEIVE, CLOSE, ABORT, and STATUS; the incoming segments, particularly those
containing
• the SYN, ACK, RST and FIN flags; and timeouts
TCP State Transition
TCP Timers
• TCP uses several timers to ensure that excessive delays are not encountered during
communications. Several of these timers are elegant, handling problems that are not
immediately obvious at first analysis. Each of the timers used by TCP is examined in the
following sections, which reveal its role in ensuring data is properly sent from one
connection to another.
• Retransmission Timer – To retransmit lost segments, TCP uses retransmission timeout
(RTO). When TCP sends a segment the timer starts and stops when the acknowledgment
is received. If the timer expires timeout occurs and the segment is retransmitted. RTO
(retransmission timeout is for 1 RTT) to calculate retransmission timeout we first need to
calculate the RTT(round trip time).
• RTT three types –
• Measured RTT(RTTm) – The measured round-trip time for a segment is the time
required for the segment to reach the destination and be acknowledged, although the
acknowledgement may include other segments.
• Smoothed RTT(RTTs) – It is the weighted average of RTTm. RTTm is likely to change
and its fluctuation is so high that a single measurement cannot be used to calculate RTO.
TCP Timers
• Persistent Timer – To deal with a zero-window-size deadlock situation, TCP uses a
persistence timer. When the sending TCP receives an acknowledgment with a window
size of zero, it starts a persistence timer. When the persistence timer goes off, the sending
TCP sends a special segment called a probe. This segment contains only 1 byte of new
data. It has a sequence number, but its sequence number is never acknowledged; it is even
ignored in calculating the sequence number for the rest of the data. The probe causes the
receiving TCP to resend the acknowledgment which was lost.
• Keep Alive Timer – A keepalive timer is used to prevent a long idle connection between
two TCPs. If a client opens a TCP connection to a server transfers some data and becomes
silent the client will crash. In this case, the connection remains open forever. So a
keepalive timer is used. Each time the server hears from a client, it resets this timer. The
time-out is usually 2 hours. If the server does not hear from the client after 2 hours, it
sends a probe segment. If there is no response after 10 probes, each of which is 75 s apart,
it assumes that the client is down and terminates the connection.
• Time Wait Timer – This timer is used during tcp connection termination. The timer starts
after sending the last Ack for 2nd FIN and closing the connection.
• TCP flow Control (Sliding Window)
• TCP Congestion Control (Stop and wait)
refer chapter 3 PPT

You might also like