KEMBAR78
Unit 4.1 Transport Layer | PDF | Transmission Control Protocol | Port (Computer Networking)
0% found this document useful (0 votes)
10 views27 pages

Unit 4.1 Transport Layer

The document discusses the transport layer's role in process-to-process delivery using protocols like UDP and TCP. It explains the differences between connectionless and connection-oriented protocols, detailing port number classifications by IANA and the structure of UDP and TCP segments. Additionally, it covers the importance of socket addresses, flow control, error control, and the establishment and termination of connections in TCP.

Uploaded by

kshitijsonkar23
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views27 pages

Unit 4.1 Transport Layer

The document discusses the transport layer's role in process-to-process delivery using protocols like UDP and TCP. It explains the differences between connectionless and connection-oriented protocols, detailing port number classifications by IANA and the structure of UDP and TCP segments. Additionally, it covers the importance of socket addresses, flow control, error control, and the establishment and termination of connections in TCP.

Uploaded by

kshitijsonkar23
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Unit-4

Transport Layer

Process-to-Process Delivery:
UDP, TCP

Surendra Kumar Keshari


Assistant Professor
KIET Group of Institutions

(Academic Purpose Only)


PROCESS-TO-PROCESS DELIVERY

The transport layer is responsible for process-to-process


delivery—the delivery of a packet, part of a message, from one
process to another.
Two processes communicate in a client/server relationship.
Types of data deliveries
Port numbers
IP addresses versus port numbers
IANA ranges

 The lANA (Internet Assigned Number Authority) has divided the port numbers
into three ranges: well known, registered, and dynamic (or private).
 Well-known ports. The ports ranging from 0 to 1023 are assigned and
controlled by lANA. These are the well-known ports.
 Registered ports. The ports ranging from 1024 to 49,151 are not assigned or
controlled by lANA. They can only be registered with lANA to prevent
duplication.
 Dynamic ports. The ports ranging from 49,152 to 65,535 are neither
controlled nor registered. They can be used by any process. These are the
ephemeral ports.
Socket address

 Process-to-process delivery needs two identifiers, IP address and the port


number, at each end to make a connection.
 The combination of an IP address and a port number is called a socket
address.
 The client socket address defines the client process uniquely just as the
server socket address defines the server process uniquely.
 A transport layer protocol needs a pair of socket addresses: the client socket
address and the server socket address.
Transport Layer

 A transport layer protocol can be either connectionless or connection-oriented.


 A connectionless transport layer treats each segment as an independent packet
and delivers it to the transport layer at the destination machine.
 A connection-oriented transport layer makes a connection with the transport
layer at the destination machine first before delivering the packets. After all the data
is transferred, the connection is terminated.
 In the transport layer, a message is normally divided into transmittable segments.
 A connectionless protocol, such as UDP, treats each segment separately.
 A connection oriented protocol, such as TCP and SCTP , creates a relationship
between the segments using sequence numbers.
Position of UDP, TCP, and SCTP in TCP/IP suite
USER DATAGRAM PROTOCOL (UDP)

The User Datagram Protocol (UDP) is called a connectionless, unreliable


transport protocol. It does not add anything to the services of IP except to
provide process-to-process communication instead of host-to-host
communication.

 UDP – unreliable connectionless transport protocol

 Why would anybody need this?


 small overhead

 suitable for short message transport

 does not require much sender-receiver interaction

 simple request-response communication with little concern about

flow & error control


Well-known ports used with UDP
User datagram format

source port number – from 0 – 65535


destination port number – 0 – 65535
length – the total length of the user datagram (header + data)
checksum – detect errors over the entire datagram
Pseudoheader for checksum calculation
Pseudoheader for checksum calculation

 The calculation of the checksum and its inclusion in a user datagram are
optional.
 The UDP checksum calculation is different from the one for IP and ICMP.
Here the checksum includes three sections: a pseudoheader, the UDP
header, and the data coming from the application layer.
 The pseudoheader is the part of the header of the IP packet in which the
user datagram is to be encapsulated with some fields filled with Os.
 If the checksum does not include the pseudoheader, a user datagram may
arrive safe and sound. However, if the IP header is corrupted, it may be
delivered to the wrong host.
 The protocol field is added to ensure that the packet belongs to UDP, and
not to other transport-layer protocols. The value of the protocol field for UDP
is 17.
 If this value is changed during transmission, the checksum calculation at
the receiver will detect it and UDP drops the packet. It is not delivered to the
wrong protocol.
TCP (Transmission Control Protocol)

TCP is a connection-oriented protocol; it creates a virtual connection


between two TCPs to send data. In addition, TCP uses flow and error control
mechanisms at the transport level.

 TCP, unlike UDP, is a stream-oriented protocol.


 TCP, allows the sending process to deliver data as a stream of bytes and
allows the receiving process to obtain data as a stream of bytes.
 TCP creates an environment in which the two processes seem to be
connected by an imaginary "tube― that carries their data across the Internet.
Well-known ports used by TCP
Stream delivery

The sending process produces (writes to) the stream of bytes, and the receiving
process consumes (reads from) them.
TCP - buffers
 Sending & receiving buffers
 Processes do not consume data at the same speed
 Sending site:
 White section: empty locations to be filled by sending process
 Blue section: bytes sent but not yet acknowledged
 Red section: bytes to be sent by sending TCP
 Receiving site:
 White section: empty locations to be filled by bytes from the networks
 Red section: received bytes to be consumed by the receiving process
TCP segments

 TCP at the sending site gathers bytes into a packet called a segment
 TCP adds a header to each segment and delivers it to IP for
transmission
 Segments can arrive out of order
 Size of the segment varies
TCP – numbering bytes

 Numbering is used for flow & error control


 Segments are not numbered, only bytes

 Full-duplex connection – numbering is independent in each direction

Numbers generated randomly from 0 to 2^32-1

 Sequence number
 The number of the first byte carried in the segment

 Acknowledgement number

 To confirm received bytes

 Defines the number of the next byte the party expects to receive

 The acknowledgement number is Cumulative


TCP numbering – an example

Imagine a TCP connection is transferring a file of 6000 bytes.


The first byte is numbered 10010.
What are the sequence numbers for each segment if data are sent in
five segments with the first four segments carrying 1000 bytes and the
last segment carrying 2000 bytes?

The following shows the sequence number for each segment:

Segment 1 ==> sequence number: 10 010 (range: 10,010 to 11,009)


Segment 2 ==> sequence number: 11 010 (range: 11,010 to 12,009)
Segment 3 ==> sequence number: 12 010 (range: 12,010 to 13,009)
Segment 4 ==> sequence number: 13 010 (range: 13,010 to 14,009)
Segment 5 ==> sequence number: 14 010 (range: 14,010 to 16,009)
TCP segment format
TCP segment

The segment consists of a 20- to 60-byte header, followed by data from the application program. The
header is 20 bytes if there are no options and up to 60 bytes if it contains options.
 Source port address. This is a 16-bit field that defines the port number of the application program in the
host that is sending the segment. This serves the same purpose as the source port address in the UDP header.
 Destination port address. This is a 16-bit field that defines the port number of the application program in
the host that is receiving the segment. This serves the same purpose as the destination port address in the
UDP header.
 Sequence number. This 32-bit field defines the number assigned to the first byte of data contained in this
segment.
 Header length. This 4-bit field indicates the number of 4-byte words in the TCP header. The length of the
header can be between 20 and 60 bytes. Therefore, the value of this field can be between 5 (5 x 4 =20) and 15
(15 x 4 =60).
 Reserved. This is a 6-bit field reserved for future use.
 Control. This field defines 6 different control bits or flags. One or more of these bits can be set at a time.
Window size. This field defines the size of the window, in bytes, that the other party must maintain. Note
that the length of this field is 16 bits, which means that the maximum size of the window is 65,535 bytes.
This value is normally referred to as the receiving window (rwnd) and is determined by the receiver. The
sender must obey the dictation of the receiver in this case.
 Checksum. This 16-bit field contains the checksum. The calculation of the checksum for TCP follows the
same procedure as the one described for UDP. However, the inclusion of the checksum in the UDP datagram
is optional, whereas the inclusion of the checksum for TCP is mandatory. The same pseudoheader, serving the
same purpose, is added to the segment. For the TCP pseudoheader, the value for the protocol field is 6.
 Urgent pointer. This l6-bit field, which is valid only if the urgent flag is set, is used when the segment
contains urgent data.
 Options. There can be up to 40 bytes of optional information in the TCP header.
Description of flags in the control field
(Control Fields enables, connection establishment, Terminations, connection abortion
and Mode of data transfer in TCP)
Connection establishment using three-way handshaking

 A SYN segment cannot carry data, but it consumes one sequence number.
 A SYN + ACK segment cannot carry data, but does consume one sequence number.
 An ACK segment, if carrying no data, consumes no sequence number.
Data transfer
Connection termination using three-way handshaking

 The FIN segment consumes one sequence number if it does not carry data.
 The FIN + ACK segment consumes one sequence number if it does not carry data.

You might also like