Professional Documents
Culture Documents
Layer
UNIT 5
Introduction
• The transport layer is responsible for process-to-
process delivery of the entire message.
• A process is an application program running on a host.
• Whereas the network layer oversees source-to-
destination delivery of individual packets, it does not
recognize any relationship between those packets.
• It treats each one independently, as though each piece
belonged to a separate message, whether or not it
does.
• The transport layer, on the other hand, ensures that the
whole message arrives intact and in order, overseeing
both error control and flow control at the source-to-
destination level.
Introduction
• Computers often run several programs at the same
time.
• For this reason, source- to-destination delivery
means delivery not only from one computer to the
next but also from a specific process on one
computer to a specific process on the other.
• The transport layer header must therefore include
a type of address called port addresses in the
Internet and TCP/IP protocol suite.
• A transport layer protocol can be either
connectionless or connection-oriented.
Introduction
• 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.
Process-to-Process Delivery
• The data link layer (Link Layer) is responsible for delivery of
frames between two neighboring nodes over a link. This is
called node-to-node delivery.
• The network layer (Internet 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
(application programs).
• We need process-to-process delivery.
• However, at any moment, several processes may be running
on the source host and several on the destination host.
Process-to-Process Delivery
• To complete the delivery, we need a mechanism to
deliver data from one of these processes running
on the source host to the corresponding process
running on the destination host.
• 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.
Process-to-Process Delivery
Client/Server Paradigm
• Although there are several ways to achieve process-to-
process communication, the most common one is
through the client/server paradigm.
• 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.
Client/Server Paradigm
• Operating systems today support both multiuser
and multiprogramming environments.
• 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 must define the following:
1. Local host
2. Local process
3. Remote host
4. Remote process
Addressing
• 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, At
the network layer, we need an IP address.
• At the transport layer, we need a transport layer
address, called a port number, to choose among
multiple processes running on the destination host.
• The destination port number is needed for delivery;
the source port number is needed for the reply.
Addressing
• The port numbers are 16-bit integers between 0 and 65,535.
• The client program defines itself with a port number, chosen
randomly by the transport layer software running on the
client host. This is the ephemeral port number.
• The server process must also define itself with a port
number.
• This port number, however, cannot be chosen randomly.
• 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 know the port number.
Addressing
• The port numbers are 16-bit integers between 0 and 65,535.
• The client program defines itself with a port number, chosen
randomly by the transport layer software running on the client
host. This is the ephemeral port number.
• The server process must also define itself with a port number.
• This port number, however, cannot be chosen randomly.
• 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 know the port number.
• The Internet has decided to use universal port numbers for
servers; these are called well-known port numbers. Every client
process knows the well-known port number of the corresponding
server process. (Or at least the assigned Port No)
Addressing
It should be clear by now that the IP addresses and port numbers play different
roles in selecting the final destination of data. The destination IP address defines
the host among the different hosts in the world. After the host has been selected,
the port number defines one of the processes on this particular host
Addressing
• 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 con- trolled 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.
Addressing
Connection-Oriented Service
• In a connection-oriented service, a connection is
first established between the sender and the
receiver.
• Data are transferred.
• At the end, the connection is released.
• TCP is a connection-oriented protocols.
Connection-Oriented TCP over Connectionless IP
Computer
Communication Network
• Applications that use UDP:
• Streaming media (Streaming media is multimedia that is constantly received
by and presented to an end-user while being delivered by a provider),
e.g. RealAudio and RealVideo.
• VoIP e.g. Skype.
• Online multiplayer games
• DNS
Computer
Communication Network
Summary of fields in the UDP header
Computer
Communication Network
• The source port is primarily needed when a reply must be sent back
to the source.
• By copying the Source port field from the incoming segment into the
Destination port field of the outgoing segment, the process sending
the reply can specify which process on the sending machine is to get
it.
Computer
Communication Network
• The UDP length field includes the 8-byte header and the data. The
minimum length is 8 bytes, to cover the header.
• The maximum length is 65,515 bytes.
• An optional Checksum is also provided for extra reliability.
Computer
Communication Network
2) TRANSMISSION CONTROL PROTOCOL(TCP)
• TCP (Transmission Control Protocol) was specifically designed to provide
a reliable end-to-end byte stream over an unreliable internetwork.
• An internetwork differs from a single network because different parts
may have wildly different topologies, bandwidths, delays, packet sizes,
and other parameters.
• TCP was designed to dynamically adapt to properties of the internetwork
and to be robust in the face of many kinds of failures.
• Applications that use TCP:
• HTTP
• FTP
• telnet, ssh (Secure Socket Shell- is a UNIX-based command interface
and protocol for securely getting access to a remote computer)
• SMTP,POP3- Post Office Protocol version 3 (POP3)
Computer
Communication Network
• TCP service is obtained by both the sender and the receiver creating
end points, called sockets.
• Each socket has a socket number (address) consisting of the IP
address of the host and a 16-bit number local to that host, called a
port which is also known as TCP Service access point.
• Port numbers below 1024 are reserved for standard services that can
usually only be started by privileged users.
• They are called well-known ports. E.g. port number 20, 21 are
reserved for FTP, port no. 25 reserved for SMTP, port no. 80 is
reserved for HTTP etc.
Computer
Communication Network
• A key feature of TCP, and one that dominates the protocol design, is
that every byte on a TCP connection has its own 32-bit sequence
number.
• The sending and receiving TCP entities exchange data in the form of
segments.
• A TCP segment consists of a fixed 20-byte header (plus an optional
part) followed by zero or more data bytes.
• The TCP software decides how big segments should be.
• It can accumulate data from several writes into one segment or can
split data from one write over multiple segments.
Computer
Communication Network
The TCP header
Computer
Communication Network
Parts of the TCP Segment header:
• The Source port and Destination port fields identify the local end
points of the connection.
• The Sequence number field is used to indicate the sequence number
of the particular packet being sent.
• The Acknowledgement number field is used to indicate the
acknowledgement number of the packet that is expected by the
receiver.
• The TCP header length field tells how many 32-bit words are
contained in the TCP header.
Computer
Communication Network
• Eight 1-bit flags:
• CWR and ECE are used to signal congestion when ECN (Explicit Congestion
Notification) is used.
• ECE is set to signal an ECN-Echo to a TCP sender to tell it to slow down when
the TCP receiver gets a congestion indication from the network.
• CWR is set to signal Congestion Window Reduced from the TCP sender to the
TCP receiver so that it knows the sender has slowed down and can stop
sending the ECN-Echo.
• URG is set to 1 if the Urgent pointer is in use. The Urgent pointer is used to
indicate a byte offset from the current sequence number at which urgent
data are to be found. This facility is used mostly for interrupt messages.
• The ACK bit is set to 1 to indicate that the Acknowledgement number is valid.
This is the case for nearly all packets. If ACK is 0, the segment does not
contain an acknowledgement, so the Acknowledgement number field is
ignored.
• The PSH bit indicates PUSHed data. The receiver is hereby kindly requested
to deliver the data to the application upon arrival and not buffer it until a full
buffer has been received.
• The RST bit is used to abruptly reset a connection that has become confused
due to a host crash or some other reason. It is also used to reject an invalid
segment or refuse an attempt to open a connection.
• The SYN bit is used to establish connections.
• The FIN bit is used to release a connection.
Computer
Communication Network
Parts of the TCP Segment header:
• The Window size field tells how many bytes may be sent starting at
the byte acknowledged. Used to set the number of segments that
can be sent before waiting for a confirmation from the destination.
• A Checksum is also provided for extra reliability. CRC (cyclic
redundancy check) of the header and data piece.
• The Options field provides a way to add extra facilities not covered by
the regular header. Used to define any additional options such as
maximum segment size
Computer
Communication Network
TCP Options
• A widely used option is the one that allows each host to specify the
MSS (Maximum Segment Size) it is willing to accept.
• The window scale option allows the sender and receiver to negotiate
a window scale factor at the start of a connection.
• The timestamp option carries a timestamp sent by the sender and
echoed by the receiver.
• SACK (Selective ACKnowledgement) option lets a receiver tell a
sender the ranges of sequence numbers that it has received.
Computer
Communication Network
TCP Connection Establishment
• Step 1 (SYN) : In the first step, client wants to establish a connection with
server, so it sends a segment with SYN(Synchronize Sequence Number)
which informs server that client is likely to start communication and with
what sequence number it starts segments with
• Step 2 (SYN + ACK): Server responds to the client request with SYN-ACK
signal bits set. Acknowledgement(ACK) signifies the response of segment it
received and SYN signifies with what sequence number it is likely to start the
segments with
• Step 3 (ACK) : In the final part client acknowledges the response of server
and they both establish a reliable connection with which they will start the
actual data transfer. The steps 1, 2 establish the connection parameter
(sequence number) for one direction and it is acknowledged. The steps 2, 3
establish the connection parameter (sequence number) for the other
direction and it is acknowledged. With these, a full-duplex communication is
established.
Closing a TCP connection