Transport Layer: Process-to-Process Delivery: Udp and TCP
Transport Layer: Process-to-Process Delivery: Udp and TCP
Process-to-Process Delivery:
UDP and TCP
TCP/IP Internet protocol Stack
• Packets of information that passes through these layers are referred by different names in each layer.
• Then the transport layer takes this message and adds transport layer headers to it. The resulting
• When the segment is passed on to the network layer, it wraps the segment with its own network
• Then when the link layer takes over these datagrams, it adds link layer related headers and pass
those packets which is then known as frames to the physical layer for transmission.
How a user data from application layer of a sender
is gradually passing through each layer
datalink
layer
Transport Layer
The network layer is only responsible for host to host
communication.
That is, it can only deliver messages to the destination computer.
Once a message has been delivered to the destination, it
still needs to be handed over to the correct process and
transport layer has the responsibility to take care of that.
Suppose you have three application processes running in your
machine. Now when your computer receives data from outside that
message needs to be directed to the correct application process.
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:
Types of data deliveries:
The data link layer is responsible for delivery of frames between two neighboring nodes over
The network layer is responsible for delivery of datagrams between two hosts. This is called
host-to-host delivery.
Communication on the Internet is not defined as the exchange of data between two nodes
or between two hosts. Real communication takes place between two processes. So that we
However, at any moment, several processes may be running on the source host and several
A process on the local host, called a client, needs services from a process usually on the
remote host, called a server. Both processes (client and server) have the same name.
For example, to get the day and time from a remote machine, we need a Daytime client
process running on the local host and a Daytime server process running on a remote
machine.
A remote computer can run several server programs at the same time, just as local
computers can run one or more client programs at the same time. For communication, we
Addresses
•Network layer IP
address
multiple processes
running on destination
host)
Addresses
Whenever we need to deliver something to one specific destination among
many, we need an address.
At the data link layer, we need a MAC address to choose one node among
several nodes if the connection is not point-to-point.
A frame in the data link layer needs a destination MAC address for
delivery and a source address for the next node's reply.
Servers are privileged and use well know ports, with port numbers 0-1023
The well-known ports are the Internet services that have been assigned a specific port. For instance,
SMTP is assigned port 25 and HTTP is assigned port 80 and FTP 21, . Servers listen on the
If the computer at the server site runs a server process and assigns a random number as the port
number, the process at the client site that wants to access that server and use its services will not
addresses
tuple
Local IP
address, local port,
Position of UDP, TCP, and SCTP in TCP/IP suite
Transport Layer protocols
The SCTP (Stream Control Transmission Protocol) is a reliable
communications protocol in computer networking which operates at
the transport layer that can be used on top of IP networks for end-to-
end communications
The User Datagram Protocol (UDP) is called a connectionless,
unreliable transport protocol.
Transmission Control Protocol (TCP) is a connection-oriented,
reliable protocol;
It creates a virtual connection between two TCPs of sending and receiving
hosts to send data.
In addition, TCP uses flow and error control mechanisms at the transport
level
USER DATAGRAM PROTOCOL (UDP)
UDP is unreliable & connectionless
Though Transmission Control Protocol (TCP) is the dominant
transport layer protocol used with most of Internet
services;
provides assured delivery, reliability and much more but all these
services cost us with additional overhead and latency.
Here, UDP comes into picture.
User Datagram Protocol (UDP) is a unreliable and
connectionless Transport Layer protocol.
Source of UDP packets doest not require acknowledgement from
receiver. So UDP is unreliable
For the 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.
Note that with UDP there is no handshaking between
sending and receiving transport-layer entities before
sending a segment.
For this reason, UDP is said to be connectionless.
How UDP works?
UDP takes messages from application process, attaches source and
destination port number fields for the multiplexing/demultiplexing
service, adds two other fields, and passes the resulting "segment"
to the network layer.
The network layer encapsulates the segment into an IP datagram
and then makes a best-effort attempt to deliver the segment to the
receiving host.
If the segment arrives at the receiving host, UDP uses the port
numbers and the IP source and destination addresses to deliver the
data in the segment to the correct application process.
Applications of UDP:
UDP is used for simple request response communication when size of
data is less and hence there is lesser concern about flow and error
control.
UDP is used for some routing update protocols like RIP(Routing
Information Protocol).
UDP does not introduce any delay to establish a connection between
sender and receiver host.
This is probably the principle reason why DNS runs over UDP rather than TCP -- DNS
would be much slower if it ran over TCP. HTTP uses TCP rather than UDP, since
reliability is critical for Web pages with text.
Following implementations uses UDP as a transport layer protocol:
NTP (Network Time Protocol)
DNS (Domain Name Service)
BOOTP, DHCP.
NNP (Network News Protocol)
TFTP, RIP, OSPF.
Application layer can do some of the tasks through UDP
Trace Route
Record Route
Time stamp
User datagram format
Source Port : Source Port is 2 Byte long field used to identify port number of source.
Destination Port : It is 2 Byte long field, used to identify the port of destined packet.
Length : Length is the length of UDP including header and the data. It is 16-bits field.
Pseudoheader for checksum calculation
The pseudo header is the part of the header of the
of the
The UDP
value of header, pseudo
the protocol header
field of information
for UDP is 17 from the IP header and the data, padded with zero
Notes – Unlike TCP, Checksum calculation is not mandatory in UDP. No Error control or flow control is
To know
provided more about checksum calculation follow the link: https://www.ques10.com/p/10930/how-
by UDP.
is-checksum-computed-in-udp-1/
Queues in UDP
Well-known ports used with UDP
UDP port number fields are each 16 bits long, therefore range for port numbers defined from 0 to 65535; port
number 0 is reserved.
In UNIX, the well-known ports are stored in a file called /etc/services.
Each line in this file gives the name of the server and the well-known port
number.
We can use the grep utility to extract the line corresponding to the
desired application.
Note that FTP can use port 21 with either UDP or TCP.
SNMP uses two port numbers (161 and 162), each for a different
purpose
TCP
23.35
TCP supports Stream oriented delivery
Sending and receiving buffers
TCP segments
23.39
Example
10001
Sequence Number of segment 1 number of 1st byte of segment 1
TCP segment format
TCP flags
TCP flags are used within TCP packet transfers to indicate a particular connection
There are a few TCP flags that are much more commonly used than others as
such SYN, ACK, and FIN.
Connection establishment Connection close
TCP sequence number & acknowledgement number
Two fields are used sequence number and acknowledgment number. Both
•Sequence Numbers
Sequence number is associated with every byte TCP sends
Sequence number for each segment is the number of the first byte
carried in that segment
Solution
The value of rwnd = 5000 − 1000 = 4000. Host B can
receive only 4000 bytes of data before overflowing its
buffer. Host B advertises this value in its next segment to A.
Example 2
Solution
The size of the window is the smaller of rwnd and cwnd,
which is 3000 bytes.
Example 3
210 209 208 207 206 205 204 203 202 201 200
23.66
Note
In modern implementations, a
retransmission occurs if the
retransmission timer expires or three
duplicate ACK segments have arrived.
Note