Unit - IV
Transport Layer
Transport Service primitives - Connection Establishment and
Release- Elements of transport protocols: Addressing - Connection
Establishment and Release – The internet transport protocols: UDP
– RPC - TCP: Service Model.
Transport Layer
The main role of the transport layer is to provide the communication
services directly to the application processes running on different
hosts.
The transport layer provides a logical communication between
application processes running on different hosts.
Although the application processes on different hosts are not
physically connected, application processes use the logical
communication provided by the transport layer to send the messages
to each other.
The transport layer protocols are implemented in the end systems but
not in the network routers.
Transport Service Primitives
Service generally includes set of various primitives. A primitive simply
means Operations.
A Service is specified by set of primitives that are available and given
to user or other various entities to access the service.
All these primitives simply tell the service to perform some action or
to report on action that is taken by peer entity.
Each of the protocol that communicates in layered architecture also
communicates in peer-to-peer manner with some of its remote
protocol entity.
Primitives are called calling functions between the layers that are
used to manage communication among the adjacent protocol layers
i.e., among the same communication node.
The set of primitives that are available generally depends upon the
nature of the service that is being provided.
Classification of Service Primitives :
Primitive Meaning
Request It represent entity that wants or request service to perform some
action or do some work (requesting for connection to remote
computer).
Indication It represent entity that is to be informed about event (receiver just
have received request of connection).
Response It represents entity that is responding to event (receiver is simply
sending the permission or allowing to connect).
Confirm It represent entity that acknowledges the response to earlier request
that has come back (sender just acknowledge the permission to get
connected to the remote host).
Primitives of Connection-Oriented Service :
Primitive Meaning
Listen When server is ready to accept request of incoming connection,
it simply put this primitive into action. Listen primitive simply
waiting for incoming connection request.
Connect This primitive is used to connect the server simply by creating
or establishing connection with waiting peer.
Accept This primitive simply accepts incoming connection from the
peer.
Receive These primitive afterwards block the server. Receive primitive
simply waits for incoming message.
Send This primitive is put into action by the client to transmit its
request that is followed by putting receive primitive into action
to get the reply. Send primitive simply sends or transfer the
message to the peer.
Disconnect This primitive is simply used to terminate or end the connection
after which no one will be able to send any of the message.
Primitives of Connectionless Service :
Primitive Meaning
Unitdata Unitdata primitive is simply required to send packet of
data or information.
Facility, Report This primitive is required for getting details about the
performance and working of the network such as delivery
statistics or report.
Elements of Transport Protocols
• Addressing
• Connection Establishment
• Connection Release
• Flow Control and Buffering
• Multiplexing
• Crash Recovery
Addressing
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. (Connectionless transport has the
same problem: to whom should each message be sent?)
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
Establishing a connection sounds easy, but it is actually
surprisingly tricky.
At first glance, it would seem sufficient for one transport
entity to just send a CONNECTION REQUEST segment to the
destination and wait for a CONNECTION ACCEPTED reply.
The problem occurs when the network can lose, delay,
corrupt, and duplicate packets.
This behavior causes serious complications
The normal setup procedure when host 1 initiates is shown in Fig.
(a).
1. 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.
3. Finally, host 1 acknowledges host 2’s choice of an initial
sequence number in the first data segment that it sends.
1. Sender starts the process with the following:
Sequence number (Seq=521): contains the random initial sequence
number generated at the sender side.
Syn flag (Syn=1): request the receiver to synchronize its sequence
number with the above-provided sequence number.
Maximum segment size (MSS=1460 B): sender tells its maximum
segment size, so that receiver sends datagram which won’t require
any fragmentation. MSS field is present inside Option field in TCP
header.
Window size (window=14600 B): sender tells about his buffer
capacity in which he has to store messages from the receiver.
2. TCP is a full-duplex protocol so both sender and receiver require a
window for receiving messages from one another.
Sequence number (Seq=2000): contains the random initial sequence
number generated at the receiver side.
Syn flag (Syn=1): request the sender to synchronize its sequence
number with the above-provided sequence number.
Maximum segment size (MSS=500 B): receiver tells its maximum
segment size, so that sender sends datagram which won’t require any
fragmentation. MSS field is present inside Option field in TCP header.
Window size (window=10000 B): receiver tells about his buffer
capacity in which he has to store messages from the sender.
Acknowledgement Number (Ack no.=522): Since sequence number
521 is received by the receiver so, it makes a request for the next
sequence number with Ack no.=522 which is the next packet
expected by the receiver since Syn flag consumes 1 sequence no.
ACK flag (ACk=1): tells that the acknowledgement number field
contains the next sequence expected by the receiver.
3. Sender makes the final reply for connection establishment in the
following way:
Sequence number (Seq=522): since sequence number = 521 in 1 st
step and SYN flag consumes one sequence number hence, the next
sequence number will be 522.
Acknowledgement Number (Ack no.=2001): since the sender is
acknowledging SYN=1 packet from the receiver with sequence
number 2000 so, the next sequence number expected is 2001.
ACK flag (ACK=1): tells that the acknowledgement number field
contains the next sequence expected by the sender.
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 Asymmetric
release is abrupt and may result in data loss.
Consider the scenario of Fig. After the connection is established, host 1
sends a segment that arrives properly at host 2.
Then host 1 sends another segment. Unfortunately, host 2 issues a
DISCONNECT before the second segment arrives.
The result is that the connection is released and data are lost.Clearly, a
more sophisticated release protocol is needed to avoid data loss.
One way is to use symmetric release, in which each direction is released
independently of the other one.
Here, a host can continue to receive data even after it has sent a
DISCONNECT segment.
Symmetric release does the job when each process has a fixed amount of
data to send and clearly knows when it has sent it.
Transport Layer Protocols
The transport layer is represented majorly by TCP and UDP
protocols. Today almost all operating systems support
multiprocessing multi-user environments.
This transport layer protocol provides connections to the
individual ports.
These ports are known as protocol ports.
Transport layer protocols work above the IP protocols and
deliver the data packets from IP serves to destination port and
from the originating port to destination IP services.
Below are the protocols used at the transport layer.
UDP (User Datagram Protocol)
UDP stands for User Datagram Protocol.
User Datagram Protocol provides a nonsequential transmission of data.
It is a connectionless transport protocol.
UDP protocol is used in applications where the speed and size of data
transmitted is considered as more important than the security and reliability.
User Datagram is defined as a packet produced by User Datagram Protocol.
UDP protocol adds checksum error control, transport level addresses, and
information of length to the data received from the layer above it.
Services provided by User Datagram Protocol(UDP) are connectionless
service, faster delivery of messages, checksum, and process-to-process
communication.
UDP Segment
While the TCP header can range from 20 to 60 bytes, the UDP header
is a fixed, basic 8 bytes.
All required header information is contained in the first 8 bytes, with
data making up the remaining portion.
Because UDP port number fields are 16 bits long, the range of
possible port numbers is defined as 0 to 65535, with port 0 being
reserved.
Source Port: Source Port is a 2 Byte long field used to identify the port
number of the source.
Destination Port: This 2-byte element is used to specify the packet's
destination port.
Length: The whole length of a UDP packet, including the data and header.
The field has sixteen bits.
Cheksum: The checksum field is two bytes long. The data is padded with
zero octets at the end (if needed) to create a multiple of two octets. It is the
16-bit one's complement of the one's complement sum of the UDP header,
the pseudo-header containing information from the IP header, and the data.
Advantages of UDP
UDP also provides multicast and broadcast transmission of data.
UDP protocol is preferred more for small transactions such as DNS lookup.
It is a connectionless protocol, therefore there is no compulsion to have a
connection-oriented network.
UDP provides fast delivery of messages.
Disadvantages of UDP
In UDP protocol there is no guarantee that the packet is delivered.
UDP protocol suffers from worse packet loss.
UDP protocol has no congestion control mechanism.
Remote Procedure Call (RPC)
Remote Procedure Call (RPC) is a powerful technique for constructing
distributed, client-server based applications.
It is based on extending the conventional local procedure calling so
that the called procedure need not exist in the same address space
as the calling procedure.
The two processes may be on the same system, or they may be on
different systems with a network connecting them.
How to Make a Remote Procedure Call
Types of RPC
Callback RPC
Callback RPC allows processes to act as both clients and servers. It
helps with remote processing of interactive applications. The server
gets a handle to the client, and the client waits during the callback.
This type of RPC manages callback deadlocks and enables peer-to-
peer communication between processes.
Broadcast RPC
In Broadcast RPC, a client’s request is sent to all servers on the
network that can handle it. This type of RPC lets you specify that a
client’s message should be broadcast. You can set up special
broadcast ports. Broadcast RPC helps reduce the load on the network.
Batch-mode RPC
Batch-mode RPC collects multiple RPC requests on the client side and
sends them to the server in one batch. This reduces the overhead of
sending many separate requests. Batch-mode RPC works best for
applications that don’t need to make calls very often. It requires a
reliable way to send data.
Working of a RPC
1. A client invokes a client stub procedure, passing parameters in the
usual way. The client stub resides within the client’s own address
space.
2. The client stub marshalls(pack) the parameters into a message.
Marshalling includes converting the representation of the parameters
into a standard format, and copying each parameter into the
message.
3. The client stub passes the message to the transport layer, which
sends it to the remote server machine. On the server, the transport
layer passes the message to a server stub, which
demarshalls(unpack) the parameters and calls the desired server
routine using the regular procedure call mechanism.
4. When the server procedure completes, it returns to the server stub
(e.g., via a normal procedure call return), which marshalls the return
values into a message.
5. The server stub then hands the message to the transport layer.
The transport layer sends the result message back to the client
transport layer, which hands the message back to the client stub.
Advantages
Easy Communication: RPC lets clients talk to servers using normal procedure calls
in high-level programming languages. This makes it simple for programmers to
work with.
Hidden Complexity: RPC hides the details of how messages are sent between
computers. This means programmers don’t need to worry about the underlying
network communication.
Flexibility: RPC can be used in both local and distributed environments. This
makes it versatile for different types of applications.
Disadvantages
Limited Parameter Passing: RPC can only pass parameters by value. It can’t pass
pointers, which limits what can be sent between computers.
Slower Than Local Calls: Remote procedure calls take longer than local procedure
calls because they involve network communication.
Vulnerable to Failures: RPC depends on network connections, other machines, and
separate processes. This makes it more likely to fail than local procedure calls.
TCP Service model
1 Process-to-Process Communication
TCP provides process-to-process communication using port numbers.
Below Table lists some well-known port numbers used by TCP
2 Stream Delivery Service
TCP, on the other hand, 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.
This imaginary environment is showed in below Figure. The
sending process produces (writes to) the stream of bytes, and
the receiving process consumes (reads from) them
Sending and Receiving Buffers
Sending and the receiving processes may not write or read data at
the same speed, TCP needs buffers for storage.
There are two buffers, the sending buffer and the receiving buffer,
one for each direction.
One way to implement a buffer is to use a circular array of I-byte
locations as shown in Figure.
For simplicity,we have shown two buffers of 20 bytes each.
Normally the buffers are hundreds or thousands of bytes, depending
on the implementation.
We also show the buffers as the same size, which is not always the
case.
4 TCP segments
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 IP layer for transmission.
The segments are encapsulated in IP datagrams and transmitted.
This entire operation is transparent to the receiving process.
Later we will see that segments may be received out of order, lost, or
corrupted and resent.
All these are handled by TCP with the receiving process unaware of
any activities.
Above fig shows how segments are created from the bytes in the
buffers
5.Full-Duplex Communication
TCP offers full-duplex service, in which data can flow in both directions at
the same time. Each TCP then has a sending and receiving buffer, and
segments move in both directions
6.Connection-Oriented Service
TCP is a connection-oriented protocol. When a process at site A wants to
send and receive data from another process at site B, the following occurs:
1. The two TCPs establish a connection between them.
2. Data are exchanged in both directions.
3. The connection is terminated.
7.Reliable Service
TCP is a reliable transport protocol. It uses an acknowledgment mechanism
to check the safe and sound arrival of data. We will discuss this feature
further in the section on error control.