Module 4 Updated
Module 4 Updated
COMPUTER NETWORKS
Module-4
Transport Layer and
Applicaton Layer
Protocols
1
Transport Layers
The transport layer is located between the network layer and the
application layer
The transport layer is responsible for providing services to the application
(hostto-host communication).
• A network-layer protocol can deliver the message only to the destination computer. However,
this is an incomplete delivery. The message still needs to be handed to the correct process.
• This is where a transport-layer protocol takes over. A transport-layer protocol is responsible
for delivery of the message to the appropriate process.
• A process on the local host, called a client, needs services from a process
usually on the remote host, called a server.
• A remote computer can run several server programs at the same time, just as
several local computers can run one or more client programs at the same
time. For communication, we must define the local host, local process,
remote host, and remote process.
• The local host and the remote host are defined using IP addresses .
• The user datagrams are not numbered. Also, unlike TCP, there is no
connection establishment and no connection termination. This means
that each user datagram can travel on a different path.
•
User datagram packet format
Contd…
• Sending a small message using UDP takes much less interaction
between the sender and receiver than using TCP.
• The format of a user datagram. The first two fields define the source
and destination port numbers, respectively.
• Third field defines the total length of the user datagram, header plus
data.
• The 16 bits can define a total length of 0 to 65,535 bytes.
• However, the total length needs to be less because a UDP user datagram
is stored in an IP datagram with the total length of 65,535 bytes.
• The last field can carry the optional checksum.
Checksum Calculation:
Steps followed in checksum calculation
Example1: Let's understand this by an example
The first thing that we do is to divide and slice it up to 16 bit pieces. Let's
assume we have three 16 bit data as below.
1001101001010110
0000101110001110
0000110111001100
If we add those three 16 bit data using binary addition. We get the below 16
bit data(Its simple binary addition).
1 0 0 1 1 0 1 0 0 1 0 1 0 1 1 0 (data)
0 0 0 0 1 0 1 1 1 0 0 0 1 1 1 0 (data)
0 0 0 0 1 1 0 1 1 1 0 0 1 1 0 0 (data)
0 1 0 0 1 1 0 0 0 1 0 0 1 1 1 1 (Checksum)
The reciever will simply add all the above 4 things. Data as well as checksum
are added together. Let's try adding it.
• At the transport layer, TCP groups a number of bytes together into a packet
called a segment. TCP adds a header to each segment (for control
purposes) and delivers the segment to the network layer for transmission.
Connection-Oriented Service
• TCP offers full-duplex service, where data can flow in both directions at
the same time. Each TCP endpoint then has its own sending and receiving
buffer, and segments move in both directions.
• 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.
• 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.
• 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.
• Control field: This field defines six different control bits or flags.One or
more of these bits can be set at a time.
Urgent pointer:This 16-bit field, which is valid only if the urgent flag is set, is
used when the segment contains urgent data. It defines a value that must be
added to the sequence number to obtain the number of the last urgent byte in
the data section of the segment.
• There are two types of sliding window protocol Go-Back-N (GBN), and
Selective Repeat (SR).
Go-Back-N (GBN)
• For this reason, N is often referred to as the window size and the GBN
protocol itself as a sliding-window protocol.
Contd…
Contd…
• Figure shows the operation of the GBN protocol for the case of a window
size of four packets. Because of this window size limitation, the sender
sends packets 0 through 3 but then must wait for one or more of these
packets to be acknowledged before proceeding.
• As each successive ACK (for example, ACK0 and ACK1) is received, the
window slides forward and the sender can transmit one new packet
(pkt4 and pkt5, respectively).
• On the receiver side, packet 2 is lost and thus packets 3, 4, and 5 are
found to be out of order and are discarded.
Working of Go-Back-N ARQ or(Go-
Back –N)
• Suppose there are a sender and a receiver, and let's assume that there are 11
frames to be sent.
• Mainly, the sequence number is decided by the sender's window size. But, for
the better understanding, we took the running sequence numbers, i.e.,
0,1,2,3,4,5,6,7,8,9,10.
• Let's consider the window size as 4, which means that the four frames can
be sent at a time before expecting the acknowledgment of the first frame.
• Step 1: Firstly, the sender will send the first four frames to the receiver, i.e.,
0,1,2,3, and now the sender is expected to receive the acknowledgment of the
0th frame
Contd..
Let's assume that the receiver has sent the acknowledgment for the 0
frame, and the receiver has successfully received it.
Contd..
The sender will then send the next frame, i.e., 4, and the window
slides containing four frames (1,2,3,4).
Contd..
The receiver will then send the acknowledgment for the frame no 1.
After receiving the acknowledgment, the sender will send the next
frame, i.e., frame no 5, and the window will slide having four frames
(2,3,4,5)
Contd..
Now, let's assume that the receiver is not acknowledging the frame no
2, either the frame is lost, or the acknowledgment is lost. Instead of
sending the frame no 6, the sender Go-Back to 2, which is the first
frame of the current window, retransmits all the frames in the current
window, i.e., 2,3,4,5.
• Example 2: In GB4, if every 6th packet being transmitted is lost and if we
have to spend 10 packets then how many transmissions are required where
N=4.
• Do it yourself
Selective Repeat (SR)
• There are, however, scenarios in which GBN itself suffers from
performance problems.
• In particular, when the window size and bandwidth-delay product are both
large, many packets can be in the pipeline.
• A single packet error can thus cause GBN to retransmit a large number of
packets, many unnecessarily.
1
Domain Name System (DNS)
To identify an entity, TCP/IP protocols use the IP address, which uniquely
identifies the connection of a host to the Internet. However, people prefer
to use names instead of numeric addresses.
Therefore, the Internet needs to have a directory system that can map a
name to an address. This is analogous to the telephone network. A
telephone network is designed to use telephone numbers, not names.
• web page consists of objects, each of which can be stored on different Web
servers.
• object can be HTML file, JPEG image, Java applet, audio file,…
• web page consists of base HTML-file which includes several referenced objects,
each addressable by a URL,
• e.g.,
HTTP overview
• FTP or File Transfer Protocol is said to be one of the earliest and also
the most common forms of transferring files on the internet. Located
in the application layer of the OSI model.
• It is what makes the FTP unique that the system provides a reliable
and efficient means of transferring files from one system to another
even if they have different file structures and operating systems.
Simple Mail Transfer mechanism (SMTP)
• SMTP is an application layer protocol.
• The client who wants to send the mail opens a TCP connection to the
SMTP server and then sends the mail across the connection.
• The SMTP server is an always-on listening mode.
• As soon as it listens for a TCP connection from any client, the SMTP
process initiates a connection through port 25.