Unit 4
Unit 4
Unit 4
Unit IV-Notes
UNIT – IV :Transport Layer: Transport Service, Elements of Transport protocols: Addressing,
Connection Establishment, Connection Release. Connection management. The Internet
Transport Protocols: Introduction to UDP, Remote Procedure calls, Introduction to TCP, The
TCP Service Model, The TCP Protocol, and The TCP Segment Header, The TCP Connection
Establishment, TCP Connection Release,TCP Connection management modeling,TCP Sliding
window,TCP Timer Management,TCP Congestion control.
The network layer provides end-to-end packet delivery using datagrams or virtual circuits. The transport layer
builds on the network layer to provide data transport from a process on a source machine to a process on a
destination machine with a desired level of reliability
Services Provided to the Upper Layers
Transport Service Primitives
Berkeley Sockets
Services Provided to the Upper Layers:
The ultimate goal of the transport layer is to provide efficient, reliable, and cost-effective data transmission
service to its users, normally processes in the application layer. To achieve this, the transport layer makes
use of the services provided by the network layer. The software and/or hardware within the transport layer
that does the work is called the transport entity
Berkeley Sockets:
Elements of Transport Protocols:
• Addressing
• Connection Establishment
• Connection Release
• Flow Control and Buffering
• Multiplexing
• Crash Recovery
Addressing:
When an application (e.g., a user) process wishes to set up a connection to a remote application
process, it must specify which one to connect to. The method normally used is to define transport
addresses to which processes can listen for connection requests. In the Internet, these endpoints
are called ports. We will use the generic term TSAP (Transport Service Access Point) to mean a
specific endpoint in the transport layer. The analogous endpoints in the network layer (i.e.,
network layer addresses) are not-surprisingly called NSAPs (Network Service Access Points). IP
addresses are examples of NSAPs.
CONNECTION ESTABLISHMENT:
(a) Normal operation, (b) Old CONNECTION REQUEST appearing out of nowhere.
Fig. (a). Host 1 chooses a sequence number, x, and sends a CONNECTION REQUEST segment
containing it to host 2. Host 2 replies with an ACK segment acknowledging x and announcing its
own initial sequence number, y. Finally, host 1 acknowledges host 2’s choice of an initial
sequence number in the first data segment that it sends.
Fig.(b), the first segment is a delayed duplicate CONNECTION REQUEST from an old
connection. This segment arrives at host 2 without host 1’s knowledge. Host 2 reacts to this
segment by sending host 1 an ACK segment, in effect asking for verification that host 1 was
indeed trying to set up a new connection.
The worst case is when both a delayed CONNECTION REQUEST and an ACK are floating
around in the subnet. This case is shown in Fig. (c).
Connection Release:
there are two styles of terminating a connection: asymmetric release and symmetric release
Asymmetric release is the way the telephone system works:
when one party hangs up, the connection is broken. Symmetric release treats the connection as
two separate unidirectional connections and requires each one to be released separately
Connection Release:
Multiplexing:
Multiplexing, or sharing several conversations over connections, virtual circuits,
and physical links plays a role in several layers of the network architecture.
In the transport layer, the need for multiplexing can arise in a number of ways.
For example, if only one network address is available on a host, all transport connections
on that machine have to use it. When a segment comes in, some way is needed to tell which process to
give it to. This situation, called multiplexing,
Crash Recovery:
If hosts and routers are subject to crashes or connections are long-lived (e.g.,large software or media
downloads), recovery from these crashes becomes an issue. If the transport entity is entirely within the
hosts, recovery from network and router crashes is straightforward. The transport entities expect lost
segments all the time and know how to cope with them by using retransmissions.
The Internet Transport Protocols:
• Introduction to UDP
• Remote Procedure Call
• The Real-Time Transport
Protocol Introduction to 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.
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. 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, which is lower than the largest number that will fit in 16 bits because of
the size limit on IP packets. An optional Checksum is also provided for extra reliability. It checksums the
header, the data, and a conceptual IP pseudo header. When performing this computation, the Checksum
field is set to zero and the data field is padded out with an additional zero byte if its length is an odd
number.
Remote Procedure Call:
Step 1 is the client calling the client stub. This call is a local procedure call, with the parameters
pushed onto the stack in the normal way.
Step 2 is the client stub packing the parameters into a message and making a system call to send
the message. Packing the parameters is called marshaling.
Step 3 is the operating system sending the message from the client machine to the server
machine.
Step 4 is the operating system passing the incoming packet to the server stub.
Finally, step 5 is the server stub calling the server procedure with the un marshaled parameters.
The reply traces the same path in the other direction
: The TCP Service Model:
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.
TCP service is obtained by both the sender and the receiver creating endpoints, 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. A port is the TCP name for a TSAP. For TCP service to be obtained, a connection
must be explicitly established between a socket on one machine and a socket on another machine..A
socket may be used for multiple connections at the same time. In other words, two or more connections
may terminate at the same socket. Connections are identified by the socket identifiers at both ends, that is,
(socket1, socket2). No virtual circuit numbers or other identifiers are used.
The TCP Protocol:
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. When the Internet began, the lines between routers were mostly 56-
kbps leased lines, so a host blasting away at full speed took over 1 week to cycle through the sequence
numbers. At modern network speeds, the sequence numbers can be consumed at an alarming rate, as we
will see later. Separate 32-bit sequence numbers are carried on packets for the sliding window position in
one direction and for acknowledgements in the reverse direction,
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. As we said before, TCP is a stream transport protocol. To ensure connectivity, each byte to be
transmitted is numbered. The sequence number tells the destination which byte in this sequence
comprises the first byte in the segment. During connection establishment, each party uses a random
number generator to create an initial sequence number (ISN), which is usually different in each direction.
Acknowledgment number: This 32-bit field defines the byte number that the receiver of the segment is
expecting to receive from the other party. If the receiver of the segment has successfully received byte
number x from the other party, it defines x + I as the acknowledgment number. Acknowledgment and data
can be piggybacked together.
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 as shown in Figure. 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 pseudo
header, serving the same purpose, is added to the segment. For the TCP pseudo header, 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. It defines the number that must be added to the sequence number to obtain the
number of the last urgent byte in the data section of the segment.
Options: There can be up to 40 bytes of optional information in the TCP header. We will not discuss
these options here; please refer to the reference list for more information
.
.TCP Connection Establishment:
1. The client sends the first segment, a SYN segment, in which only the SYN flag is set. A SYN segment
cannot carry data, but it consumes one sequence number.
2. The server sends the second segment, a SYN +ACK segment, with 2 flag bits set: SYN and ACK. This
segment has a dual purpose. It is a SYN segment for communication in the other direction and serves as
the acknowledgment for the SYN segment. It consumes one sequence number. A SYN+ACK segment
cannot carry data, but does consume one sequence number
3. The client sends the third segment. This is just an ACK segment. It acknowledges the receipt of the
second segment with the ACK flag and acknowledgment number field. Note that the sequence number in
this segment is the same as the one in the SYN segment; the ACK segment does not consume any
sequence numbers.
Dynamic Host Configuration Protocol: The Dynamic Host Configuration Protocol (DHCP) is
a Network Management Protocol used on Internet protocol (IP) networks for automatically assigning IP
address and other communication parameters to devices connected to the network using a client -
server architecture. DHCP operations fall into four phases: server discovery, IP lease offer, IP lease
request, and IP lease acknowledgement. These stages are often abbreviated as DORA for discovery, offer,
request, and acknowledgement. Depending on implementation, the DHCP server may have three methods
of allocating IP addresses:
Dynamic allocation :A Network administrator reserves a range of IP addresses for DHCP, and each
DHCP client on the LAN is configured to request an IP address from the DHCP Server during network
initialization. The request-and-grant process uses a lease concept with a controllable time period, allowing
the DHCP server to reclaim and then reallocate IP addresses that are not renewed
Automatic allocation: The DHCP server permanently assigns an IP address to a requesting client from a
range defined by an administrator. This is like dynamic allocation, but the DHCP server keeps a table of
past IP address assignments, so that it can preferentially assign to a client the same IP address that the
client previously had.
Manual allocation: This method is also variously called static DHCP allocation, fixed address
allocation, reservation, and MAC/IP address binding. An administrator maps a unique identifier (a client
id or MAC address) for each client to an IP address, which is offered to the requesting client. DHCP
servers may be configured to fall back
TCP Connection Release :