0% found this document useful (0 votes)
11 views26 pages

Xodo

The document discusses the Transport Layer, focusing on multiplexing and demultiplexing in messaging applications like Telegram and WhatsApp, and the Transmission Control Protocol (TCP) as a connection-oriented protocol. It explains the TCP three-way handshake process, header fields, and compares TCP with the User Datagram Protocol (UDP), highlighting TCP's reliability and connection management features. Additionally, it covers Quality of Service (QoS) parameters in the transport layer, emphasizing the importance of reliable data transfer and flow control.

Uploaded by

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

Xodo

The document discusses the Transport Layer, focusing on multiplexing and demultiplexing in messaging applications like Telegram and WhatsApp, and the Transmission Control Protocol (TCP) as a connection-oriented protocol. It explains the TCP three-way handshake process, header fields, and compares TCP with the User Datagram Protocol (UDP), highlighting TCP's reliability and connection management features. Additionally, it covers Quality of Service (QoS) parameters in the transport layer, emphasizing the importance of reliable data transfer and flow control.

Uploaded by

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

Unit IV

Transport Layer
Multiplexing and Demultiplexing
• Let us consider two messaging apps that are widely used nowadays viz. Telegram and
WhatsApp. Suppose A is the sender and B is the receiver. Both sender and receiver
have these applications installed in their system (say smartphone). Suppose A wants
to send messages to B in WhatsApp and telegram both. In order to do so, A must
mention the IP address of B and destination port number of the WhatsApp while
sending the message through the WhatsApp application. Similarly, for the latter case,
A must mention the IP address of B and the destination port number of the Telegram
while sending the message.
• Now the messages from both the apps will be wrapped up along with
appropriate headers(viz. source IP address, destination IP address, source port
no, destination port number) and sent as a single message to the receiver. This
process is called multiplexing. At the destination, the received message is
unwrapped and constituent messages (viz messages from a Telegram and
WhatsApp application) are sent to the appropriate application by looking to the
destination the port number. This process is called demultiplexing. Similarly, B
can also transfer the messages to A.
Telegram
Telegram
Transmission Control Protocol (TCP)
• Transmission Control Protocol (TCP) is a connection-oriented protocol for
communications that helps in the exchange of messages between different
devices over a network.

• It is one of the main protocols of the TCP/IP suite.

• TCP establishes a reliable connection between sender and receiver using the
three-way handshake (SYN, SYN-ACK, ACK) and it uses a four-step handshake
(FIN, ACK, FIN, ACK) to close connections properly.
TCP 3-way handshake process
• It involves three steps: SYN
(Synchronize), SYN-ACK
(Synchronize- Acknowledge),
and ACK (Acknowledge).
• Step 1 (SYN): In the first step, the client wants to establish a connection with a
server, so it sends a segment with SYN(Synchronize Sequence Number) which
informs the server that the 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 the 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 the server
and they both establish a reliable connection with which they will start the
actual data transfer
TCP Header
Header Fields
• Source Port Address – A 16-bit field that holds the port address of the application that is
sending the data segment.

• Destination Port Address – A 16-bit field that holds the port address of the application in
the host that is receiving the data segment.

• Sequence Number – A 32-bit field that holds the sequence number, i.e, the byte number of
the first byte that is sent in that particular segment. It is used to reassemble the message at
the receiving end of the segments that are received out of order.

• Acknowledgement Number – A 32-bit field that holds the acknowledgement number, i.e,
the byte number that the receiver expects to receive next. It is an acknowledgement for the
previous bytes being received successfully.
• Header Length (HLEN) – This is a 4-bit field that indicates the length of the TCP header by a
number of 4-byte words in the header, i.e if the header is 20 bytes(min length of TCP
header), then this field will hold 5 (because 5 x 4 = 20) and the maximum length: 60 bytes,
then it’ll hold the value 15(because 15 x 4 = 60). Hence, the value of this field is always
between 5 and 15.

• Control flags – These are 6 1-bit control bits that control connection establishment,
connection termination, connection abortion, flow control, mode of transfer etc. Their
function is:
• URG: Urgent pointer is valid
• ACK: Acknowledgement number is valid( used in case of cumulative acknowledgement)
• PSH: Request for push
• RST: Reset the connection
• SYN: Synchronize sequence numbers
• FIN: Terminate the connection
• Window size – This field tells the window size of the sending TCP in bytes.

• Checksum – This field holds the checksum for error control. It is mandatory in
TCP as opposed to UDP.

• Urgent pointer – This field (valid only if the URG control flag is set) is used to
point to data that is urgently required that needs to reach the receiving
process at the earliest. The value of this field is added to the sequence
number to get the byte number of the last urgent byte.
Q. The following is the dump of TCP header in hexa deciaml format: 05320017
00000001 00000000 500207FF 00000000.
Find: i) what is the sequence number?
ii) what is the destination port number?
iii) What is the acknowledgement number?
iv) What is the window size?

Solution: Each group above is 8 hexadecimal digits,


1 hex digit = 4 bits
8 hex digits = 32 bits = 4 bytes
5 groups:→ 5 × 4 bytes = 20 bytes total
• Source Port (2 bytes = 4 hex digits)= 0532

= 0532 (hexadecimal) = 1330 (decimal)

• Destination Port (2 Bytes)

0017 = 0017 = 23 (decimal)

Destination Port = 23 (This is the port used for Telnet)

• Sequence Number (4 bytes)

00000001 = 1 (decimal)

• Acknowledgment Number (4 bytes)

00000000 = 0 (decimal)
• Data Offset + Reserved + Flags (2 bytes)
• given: 5002
• Split into:
• Data Offset (4 bits) = 5 (means 5 * 4 = 20 bytes TCP header length)
• Reserved (6 bits) = 000000
• Flags (6 bits) = 000010→ Only the SYN flag is set.

• Window size (2 Bytes)


07FF = 2047 (decimal)

• Checksum (2 bytes)
0000 = 0000 (normally computed during transmission)

• Urgent Pointer (2 bytes)


0000 = 0 (means no urgent data)
Header Fields final answer:

Field Value
Source Port 1330
Destination Port 23 (Telnet)
Sequence Number 1
Acknowledgment Number 0
Header Length 20 bytes
Flags SYN
Window Size 2047
Checksum 0
Urgent Pointer 0
User Datagram Protocol (UDP)
• It is an unreliable and connectionless protocol.

• No need for connection establishment.

• Used for sending time sensitive data.


UDP Header
• 8-byte fixed and simple header

• Source Port: 2 Byte long.

• Destination Port: 2 Byte long.

• Length: Data length is 16-bits.

• Checksum:2 Bytes long.

Q. TCP vs UDP?
Connection Management
• Includes:
• Connection establishment

• Data transfer

• Connection termination

• Connection establishment:
• Client → Server: Sends SYN (synchronize sequence numbers)

• Server → Client: Sends SYN + ACK (acknowledges and synchronizes)

• Client → Server: Sends ACK (acknowledges server's SYN)


• Data Transfer
• Send and receive data

• Use sequence numbers and acknowledgment numbers

• Apply flow control (using window size)

• Use error control (retransmissions if needed)

• Connection Termination
• Client → Server: Sends FIN (finish)

• Server → Client: Sends ACK (acknowledge FIN)

• Server → Client: Sends FIN (now server wants to close)

• Client → Server: Sends ACK (final acknowledgment)


Flow Control
• TCP uses a sliding window mechanism.

• The receiver tells the sender how much data it can accept (called the window
size, in bytes).

• The sender can send only that much data without waiting for an
acknowledgment.

• Example:
• Receiver sends: Window Size = 5000
• Sender can send 5000 bytes of data before it must stop and wait for an ACK.
Window management
• There are three TCP windows used in a TCP connection:
• Receive Window (RWIN)

• Send Window (SWIN)

• Congestion Window (CWIN)

• RWIN: managed by receiver


• how much data a TCP receiver is willing to accept before sending an acknowledgement
(ACK) back to the TCP sender. The receiver will advertise its RWIN to the sender and
thus the sender knows it can’t send more than an RWINs worth of data before
receiving and ACK from receiver.
• SWIN: managed by sender
• Dictates how much data a TCP sender will be allowed send before it must
receive an ACK from the TCP receiver.

• Depends on RWIN (from receiver) and CWIN (congestion control).

SWIN = min(RWIN, CWIN)

• CWIN: managed by sender


• It is a variable that changes dynamically according to the conditions of the
network.

• Increases with successful ACKs, decreases on packet loss.


TCP Congestion Policy

• Homework
Quality of Services
• Quality of Service (QoS) refers to the performance level of a service,
especially in terms of data transmission between applications over a
network.

• In the transport layer, QoS focuses on ensuring that data is delivered:


• Reliably

• Timely

• In order

• With minimal packet loss and delay


Key Parameters of QoS in the Transport Layer

Parameter Description

Bandwidth Amount of data that can be transmitted per second.

Latency Time delay between sending and receiving data.

Jitter Variation in packet arrival times (important in audio/video streaming).

Packet Loss The number of data packets lost during transmission.

Error Rate Frequency of errors in transmitted data (handled using retransmission).

Reliability Ensuring that packets arrive correctly and in order.


TCP provides QoS:

• TCP improves service quality using:


• Reliable Data Transfer (using acknowledgments and retransmission)
• Flow Control (via sliding window and RWIN)
• Congestion Control (using CWIN)
• In-order Delivery (sequence numbers)

You might also like