0% found this document useful (0 votes)
5 views

Module 4

Computer Networks Notes _ Mod 4

Uploaded by

Siddharth Jha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Module 4

Computer Networks Notes _ Mod 4

Uploaded by

Siddharth Jha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 126

MODULE 4

◦ Transport Layer
Transport Layer Services, Connectionless & Connection-oriented Protocols
Transport Layer protocols: User Datagram Protocol: UDP Services, UDP Applications,
Transmission Control Protocol: TCP Services, TCP Features, Segment, A TCP Connection,
Windows in TCP, Flow Control, Error Control, TCP Congestion Control, TCP Timers.
◦ Session Layer:
Session layer design issues, Session Layer protocol - Remote Procedure Call (RPC),
• The transport layer is a 4th layer from the top.
• 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 protocols are implemented in the end systems but not in the network routers.
• A computer network provides more than one protocol to the network applications. For example, TCP and UDP are two
transport layer protocols that provide a different set of services to the network layer.
• All transport layer protocols provide multiplexing/demultiplexing service. It also provides other services such as reliable data
transfer, bandwidth guarantees, and delay guarantees.
• Each of the applications in the application layer has the ability to send a message by using TCP or UDP. The application
communicates by using either of these two protocols. Both TCP and UDP will then communicate with the internet protocol in
the internet layer. The applications can read and write to the transport layer. Therefore, we can say that communication is a
two-way process.
◦ network layer: logical communication between hosts
◦ transport layer: logical communication between processes
◦ relies on, enhances, network layer services

Household analogy:
12 kids sending letters to 12 kids
◦ processes = kids
◦ app messages = letters in envelopes
◦ hosts = houses
◦ transport protocol = Ann and Bill
◦ network-layer protocol = postal service
◦ The services provided by the transport layer protocols can be divided into five categories:
• End-to-end delivery
• Addressing
• Reliable delivery
• Flow control
• Multiplexing
◦ End-to-end delivery:
◦ The transport layer transmits the entire message to the destination. Therefore, it ensures the end-to-end delivery of an entire
message from a source to the destination.

◦ Reliable delivery:
◦ The transport layer provides reliability services by retransmitting the lost and damaged packets.

◦ The reliable delivery has four aspects:


• Error control
• Sequence control
• Loss control
• Duplication control
◦ Error Control
• The primary role of reliability is Error Control. In reality, no transmission will be 100 percent error-free delivery. Therefore, transport
layer protocols are designed to provide error-free transmission.
◦ Sequence Control
• The second aspect of the reliability is sequence control which is implemented at the transport layer.
• On the sending end, the transport layer is responsible for ensuring that the packets received from the upper layers can be used
by the lower layers. On the receiving end, it ensures that the various segments of a transmission can be correctly reassembled.
◦ Loss Control
◦ Loss Control is a third aspect of reliability. The transport layer ensures that all the fragments of a transmission arrive at the
destination, not some of them. On the sending end, all the fragments of transmission are given sequence numbers by a
transport layer. These sequence numbers allow the receiver?s transport layer to identify the missing segment.
◦ Duplication Control
◦ Duplication Control is the fourth aspect of reliability. The transport layer guarantees that no duplicate data arrive at the
destination. Sequence numbers are used to identify the lost packets; similarly, it allows the receiver to identify and discard
duplicate segments.

◦ Flow Control
◦ Flow control is used to prevent the sender from overwhelming the receiver. If the receiver is overloaded with too much data,
then the receiver discards the packets and asking for the retransmission of packets. This increases network congestion and
thus, reducing the system performance. The transport layer is responsible for flow control. It uses the sliding window protocol
that makes the data transmission more efficient as well as it controls the flow of data so that the receiver does not become
overwhelmed. Sliding window protocol is byte oriented rather than frame oriented.
◦ Multiplexing
◦ The transport layer uses the multiplexing to improve transmission efficiency.
◦ Multiplexing can occur in two ways:
• Upward multiplexing: Upward multiplexing means multiple transport layer connections use the same network connection.
To make more cost-effective, the transport layer sends several transmissions bound for the same destination along the same
path; this is achieved through upward multiplexing.
◦ Downward multiplexing: Downward multiplexing means one transport layer connection uses the multiple network
connections. Downward multiplexing allows the transport layer to split a connection among several paths to improve the
throughput. This type of multiplexing is used when networks have a low or slow capacity.
◦ Addressing
• According to the layered model, the transport layer interacts with the functions of the session layer. Many protocols combine
session, presentation, and application layer protocols into a single layer known as the application layer. In these cases, delivery
to the session layer means the delivery to the application layer. Data generated by an application on one machine must be
transmitted to the correct application on another machine. In this case, addressing is provided by the transport layer.
• The transport layer provides the user address which is specified as a station or port. The port variable represents a particular
TS user of a specified station known as a Transport Service access point (TSAP). Each station has only one transport entity.
• The transport layer protocols need to know which upper-layer protocols are communicating.
◦ Transport Layer protocols
• The transport layer is represented by two protocols: TCP and UDP.
• The IP protocol in the network layer delivers a datagram from a source host to the destination host.
• Nowadays, the operating system supports multiuser and multiprocessing environments, an executing program is called a
process. When a host sends a message to other host means that source process is sending a process to a destination process.
The transport layer protocols define some connections to individual ports known as protocol ports.
• An IP protocol is a host-to-host protocol used to deliver a packet from source host to the destination host while transport layer
protocols are port-to-port protocols that work on the top of the IP protocols to deliver the packet from the originating port to
the IP services, and from IP services to the destination port.
• Each port is defined by a positive integer address, and it is of 16 bits.
◦ UDP
• UDP stands for User Datagram Protocol.
• UDP is a simple protocol and it provides no sequenced transport functionality.
• UDP is a connectionless protocol.
• This type of protocol is used when reliability and security are less important than speed and size.
• UDP is an end-to-end transport level protocol that adds transport-level addresses, checksum error control, and length
information to the data from the upper layer.
• The packet produced by the UDP protocol is known as a user datagram.
◦ User Datagram Format
◦ The user datagram has a 16-byte header which is shown below:
◦ Where,
• Source port address: It defines the address of the application process that has delivered a message. The source port address is
of 16 bits address.
• Destination port address: It defines the address of the application process that will receive the message. The destination port
address is of a 16-bit address.
• Total length: It defines the total length of the user datagram in bytes. It is a 16-bit field.
• Checksum: The checksum is a 16-bit field which is used in error detection.
◦ Disadvantages of UDP protocol
• UDP provides basic functions needed for the end-to-end delivery of a transmission.
• It does not provide any sequencing or reordering functions and does not specify the damaged packet when reporting an error.
• UDP can discover that an error has occurred, but it does not specify which packet has been lost as it does not contain an ID or
sequencing number of a particular data segment.
◦ TCP
• TCP stands for Transmission Control Protocol.
• It provides full transport layer services to applications.
• It is a connection-oriented protocol means the connection established between both the ends of the transmission. For creating
the connection, TCP generates a virtual circuit between sender and receiver for the duration of a transmission.
◦ Features Of TCP protocol
• Stream data transfer: TCP protocol transfers the data in the form of contiguous stream of bytes. TCP group the bytes in the
form of TCP segments and then passed it to the IP layer for transmission to the destination. TCP itself segments the data and
forward to the IP.
• Reliability: TCP assigns a sequence number to each byte transmitted and expects a positive acknowledgement from the
receiving TCP. If ACK is not received within a timeout interval, then the data is retransmitted to the destination.
The receiving TCP uses the sequence number to reassemble the segments if they arrive out of order or to eliminate the
duplicate segments.
• Flow Control: When receiving TCP sends an acknowledgement back to the sender indicating the number the bytes it can
receive without overflowing its internal buffer. The number of bytes is sent in ACK in the form of the highest sequence
number that it can receive without any problem. This mechanism is also referred to as a window mechanism.
• Multiplexing: Multiplexing is a process of accepting the data from different applications and forwarding to the different
applications on different computers. At the receiving end, the data is forwarded to the correct application. This process is
known as demultiplexing. TCP transmits the packet to the correct application by using the logical channels known as ports.
• Logical Connections: The combination of sockets, sequence numbers, and window sizes, is called a logical connection. Each
connection is identified by the pair of sockets used by sending and receiving processes.
• Full Duplex: TCP provides Full Duplex service, i.e., the data flow in both the directions at the same time. To achieve Full
Duplex service, each TCP should have sending and receiving buffers so that the segments can flow in both the directions. TCP
is a connection-oriented protocol. Suppose the process A wants to send and receive the data from process B. The following
steps occur:
• Establish a connection between two TCPs.
• Data is exchanged in both the directions.
• The Connection is terminated.
◦ Where,
• Source port address: It is used to define the address of the application program in a source computer. It is a 16-bit field.
• Destination port address: It is used to define the address of the application program in a destination computer. It is a 16-bit
field.
• Sequence number: A stream of data is divided into two or more TCP segments. The 32-bit sequence number field represents
the position of the data in an original data stream.
• Acknowledgement number: A 32-field acknowledgement number acknowledge the data from other communicating devices.
If ACK field is set to 1, then it specifies the sequence number that the receiver is expecting to receive.
• Header Length (HLEN): It specifies the size of the TCP header in 32-bit words. The minimum size of the header is 5 words,
and the maximum size of the header is 15 words. Therefore, the maximum size of the TCP header is 60 bytes, and the
minimum size of the TCP header is 20 bytes.
• Reserved: It is a six-bit field which is reserved for future use.
• Control bits: Each bit of a control field functions individually and independently. A control bit defines the use of a segment or
serves as a validity check for other fields.
◦ There are total six types of flags in control field:
• URG: The URG field indicates that the data in a segment is urgent.
• ACK: When ACK field is set, then it validates the acknowledgement number.
• PSH: The PSH field is used to inform the sender that higher throughput is needed so if possible, data must be pushed with
higher throughput.
• RST: The reset bit is used to reset the TCP connection when there is any confusion occurs in the sequence numbers.
• SYN: The SYN field is used to synchronize the sequence numbers in three types of segments: connection request, connection
confirmation ( with the ACK bit set ), and confirmation acknowledgement.
• FIN: The FIN field is used to inform the receiving TCP module that the sender has finished sending data. It is used in
connection termination in three types of segments: termination request, termination confirmation, and acknowledgement of
termination confirmation.
• Window Size: The window is a 16-bit field that defines the size of the window.
• Checksum: The checksum is a 16-bit field used in error detection.
• Urgent pointer: If URG flag is set to 1, then this 16-bit field is an offset from the sequence number indicating that it is a last
urgent data byte.
• Options and padding: It defines the optional fields that convey the additional information to the receiver.
UDP
UDP SERVICES
TCP services
◦ Following are some of the services offered by the Transmission Control Protocol (TCP) to the processes at the
application layer:
• Stream Delivery Service.
• Sending and Receiving Buffers.
• Bytes and Segments.
• Full Duplex Service
• Connection Oriented Service.
• Reliable Service.
◦ Stream Delivery Service
◦ TCP is a stream-oriented protocol. It enables the sending process to deliver data as a stream of bytes and the
receiving process to acquire data as a stream of bytes.
◦ TCP creates a working environment so that the sending and receiving procedures are connected by an imaginary
"tube", as shown in the figure below:
◦ Sending and Receiving Buffers
◦ The sending and receiving processes cannot produce and receive data at the same speed. Hence, TCP
needs a buffer for storage.
◦ There are two methods of buffers used in each dissection, which are as follows:
• Sending Buffer
• Receiving Buffer
◦ The buffer has three types of locations, which are as follows:
• Empty Locations.
• Locations that contain the bytes which have been sent, but not acknowledged. These bytes are kept in
the buffer till an acknowledgment is received.
• The location that contains the bytes which are to be sent by the sending TCP
◦ Bytes and Segments
◦ Buffering is used to handle the difference between the speed of data transmission and data consumption.
But only buffering is not enough.
◦ We need one more step before sending the data on the Internet Protocol (IP) layer as a TCP service
provider. It needs to send data in the form of packets and not as a stream of bytes.
◦ At the transport layer, TCP groups several bytes into a packet and this is called a segment. A header is
added to each segment to exercise control.
◦ The segment is encapsulated in an IP diagram and then transmitted. The entire operation is transparent to
the receiving process. The segment may be deceived out of order, lost or corrupted when it receives the
receiving end.
◦ The figure given below shows how the segments are created from the bytes in the buffers:
◦ Full-Duplex Service
◦ TCP offers a full-duplex service where the data can flow in both directions simultaneously. Each TCP will
then have a sending buffer and receiving buffer. The TCP segments are sent in both directions.
◦ Connection-Oriented Service
◦ We are already aware that the TCP is a connection-oriented protocol. When a process wants to communicate
(send and receive) with another process (process -2), the sequence of operations is as follows:
• TCP of process-1 informs TCP of process-2 and gets its approval.
• TCP of process-1 tells TCP of process-2 exchange data in both directions.
• After completing the data exchange, when buffers on both sides are empty, the two TCPs destroy their
buffers
◦ The type of connection in TCP is not physical, but it is virtual. The TCP segment encapsulated in an IP
datagram can be sent out of order. These segments can get lost or corrupted and may have to be resend.
Each segment may take a different path to reach the destination.
◦ Reliable Service
◦ TCP is a reliable transport protocol. It uses an acknowledgment mechanism for checking the safe and sound
arrival of data.
TCP segment
TCP segment = TCP header + Data chunk
Source Port
It is a 16-bit source port number used by the receiver to reply.
Destination Port
It is a 16-bit destination port number.
Sequence Number
The sequence number of the first data byte in this segment. During the SYN Control bit is set, and the
sequence number is n, and the first data byte is n + 1.
Acknowledgement Number
If the ACK control bit is set, this field contains the next number that the receiver expects to receive.
Data Offset
The several 32-bit words in the TCP header shows from where the user data begins.
Reserved (6 bit)
◦ It is reserved for future use.
◦ URG
◦ It indicates an urgent pointer field that data type is urgent or not.
◦ ACK
◦ It indicates that the acknowledgement field in a segment is significant, as discussed early.
◦ PUSH
◦ The PUSH flag is set or reset according to a data type that is sent immediately or not.
◦ RST
It Resets the connection.
◦ SYN
◦ It synchronizes the sequence number.
◦ FIN
◦ This indicates no more data from the sender.
Window
It is used in Acknowledgement segment. It specifies the number of data bytes, beginning with the one indicated in
the acknowledgement number field that the receiver is ready to accept.
Checksum
It is used for error detection.
Options
The IP datagram options provide additional punctuality. It can use several optional parameters between a TCP
sender and receiver. It depends on the options used. The length of the field may vary in size, but it can't be larger
than 40 bytes due to the header field's size, which is 4 bit.
The most typical option is the maximum segment size MASS option. A TCP receiver communicates to the TCP
sender the total length of the segment it can accept with this option.
Padding
Options in each may vary in size, and it may be necessary to "pad" the TCP header with zeros so that the segment
ends on a 32-bit word boundary as per the standard.
Data
Although in some cases like acknowledgement segments with no data in the reverse direction, the variable-length
field carries the application data from sender to receiver. This field, connected with the TCP header fields, constitute
a TCP segment.
TCP Connection
◦ Three-Way HandShake or a TCP 3-way handshake is a process which is used in a TCP/IP network to
make a connection between the server and client. It is a three-step process that requires both the client
and server to exchange synchronization and acknowledgment packets before the real data
communication process starts.
◦ Three-way handshake process is designed in such a way that both ends help you to initiate, negotiate, and
separate TCP socket connections at the same time. It allows you to transfer multiple TCP socket
connections in both directions at the same time .
Message Description

Used to initiate and establish a connection. It also helps you to


Syn
synchronize sequence numbers between devices.

ACK Helps to confirm to the other side that it has received the SYN.

SYN-ACK SYN message from local device and ACK of the earlier packet.

FIN Used to terminate a connection.


• Step 1: In the first step, the client establishes a connection with a server. It sends a segment with SYN
and informs the server about the client should start communication, and with what should be its sequence
number.
• Step 2: In this step server responds to the client request with SYN-ACK signal set. ACK helps you to
signify the response of segment that is received and SYN signifies what sequence number it should able
to start with the segments.
• Step 3: In this final step, the client acknowledges the response of the Server, and they both create a
stable connection will begin the actual data transfer process.
◦ Here is a simple example of the three-way handshake process that is consists of three steps:
• Host X begins the connection by sending the TCP SYN packet to its host destination. The packets
contain a random sequence number (For example, 4321) that indicates the beginning of the sequence
numbers for data that the Host X should transmit.
• After that, the Server will receive the packet, and it responds with its sequence number. It’s response also
includes the acknowledgment number, that is Host X’s sequence number incremented with 1 (Here, it is
4322).
• Host X responds to the Server by sending the acknowledgment number that is mostly server’s sequence
number that is incremented by 1.
◦ After the data transmission process is over, TCP automatically terminates the connection between two
separate endpoints.
Summary
• TCP 3-way handshake or three-way handshake or TCP 3-way handshake is a process which is used in a
TCP/IP network to make a connection between server and client.
• Syn use to initiate and establish a connection
• ACK helps to confirm to the other side that it has received the SYN.
• SYN-ACK is a SYN message from local device and ACK of the earlier packet.
• FIN is used for terminating a connection.
• TCP handshake process, a client needs to initiate the conversation by requesting a communication
session with the Server
• In the first step, the client establishes a connection with a server
• In this second step, the server responds to the client request with SYN-ACK signal set
• In this final step, the client acknowledges the response of the Server
• TCP automatically terminates the connection between two separate endpoints.
Data Transfer in TCP
Connection termination in TCP
TRANSPORT-LAYER PROTOCOLS
• Simple connectionless protocol
• No flow control and error control
• Connection-oriented protocol
• Stop-and-Wait protocol
• Provide flow and error control
• Go-Back-N protocol
• Efficient version of Stop-and-Wait protocol
• Selective-Repeat Protocol
• Suited to handle packet loss
• Piggybacking
Simple Protocol
Stop and wait protocol
Sliding window protocol
Go-Back –N ARQ
Selective Repeat ARQ
Lost acknowledgement
Lost acknowledgment corrected by resending a segment
TCP Congestion control
Congestion avoidance additive increase
Example of Taho TCP
Session Layer:

◦ Session layer design issues


◦ Session Layer protocol - Remote Procedure Call (RPC),
• 5th layer of OSI Reference Model
• Responsible for
• Opening session
• Managing session
• Terminating session

• For two computer to communicate there must be channels – open
• May have more than one channel
• Through the channels the messages are transmitted
• Channels are nothing but Sessions
• Session layers is not concerned about data integrity
• Associated with the exchange of data
• provide a way for devices or nodes to communicate.
• Session layer provides services like
• Authentication,

• Authorization,
• Dialog Control,
• Dialog separation
◦ Authentication
• Authentication is done on the network devices.
• verifying who you are
• Logging on to a server with a username and password is authentication.
• The main purpose of authentication is security.
• Without authentication, user's data stored on a server is unsafe on the grounds that everyone can get it
from the server.
◦ Authorization
• After being authenticated
• process of verifying what a user is entitled to do or access on a given server
• authorization is configured on every server
• It is to avoid intrusion on users' personal data

• dialog control
• it determines whose turn it is to transfer data in a session
• In a given open session, a device plays dual roles, which is requesting services and
replying with services.
• Dialog control determines which role they are playing at any given moment.
• dialog control is critically significant for data transmission.
• provides three different modes or ways of communication, which are
• simplex
◦ eg: Radio
• half-duplex
◦ eg: Walkie talkie
• full-duplex
◦ eg: skype
• Dialog separation
• It is concerned with the initiation, termination, and managing of
communication.
• error occurred during transmission which led to the loss of data.
In this case, computer has to resend the lost data as well as the
received ones.
• It is responsible for solving problems that may occur during data
transmission. It allows users to resume data transfer from where
an error happens without any need to start over.
• when an error occurs during transmission, the sender does not need to start sending data from the beginning, it rather
start from where it breaks. This is achieved through synchronization.
• If the session is closed by mistake, the dialog separation has the ability to re-establish the connection and start from
where it leaves off.
• During the transmission of data, dialog separation allows a process to add checkpoints to each set of data.

each piece of data is assigned a sequence number


• when an error occurs, the receiver can re-synchronize the state of the session to a previous synchronization point.
Remote Procedure call

You might also like