0% found this document useful (0 votes)
9 views46 pages

25 Transmission Control Protocol 12-03-2025

The document discusses Transport Layer Protocols, specifically TCP and UDP, highlighting TCP's reliability, connection-oriented nature, and flow control mechanisms, while contrasting it with UDP's simplicity and lower overhead. It details TCP segment formats, connection establishment and termination processes, as well as examples of UDP header analysis and checksum calculations. Additionally, it covers port numbers and their classifications, emphasizing the importance of well-known ports for various networking services.
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)
9 views46 pages

25 Transmission Control Protocol 12-03-2025

The document discusses Transport Layer Protocols, specifically TCP and UDP, highlighting TCP's reliability, connection-oriented nature, and flow control mechanisms, while contrasting it with UDP's simplicity and lower overhead. It details TCP segment formats, connection establishment and termination processes, as well as examples of UDP header analysis and checksum calculations. Additionally, it covers port numbers and their classifications, emphasizing the importance of well-known ports for various networking services.
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/ 46

Transport Layer Protocols:

UDP and TCP


TCP
 Reliable byte-stream service
 More complex transmitter & receiver
 Connection-oriented: full-duplex unicast connection between
client & server processes
 Connection setup, connection state, connection release
 Higher header overhead
 Error control, flow control, and congestion control
 Higher delay than UDP
 Most applications use TCP
 HTTP, SMTP, FTP, TELNET, POP3, …
Types of data deliveries

07-05-2025 Prakasam P/BECE401L/Fall 2023-24 3


Port numbers

• The client may choose any random port number


(Ephemeral Port number)
• The universal port numbers are assigned for server.
07-05-2025
(Well-known Port Number)
Prakasam P/BECE401L/Fall 2023-24 4
Figure 24-16

TCP Segment Format


The following is a dump of a TCP header in hexadecimal
format
05 32 00 17 00 00 00 01 00 00 00 00 50 02 07 FF 00 00 00 00
a. What is the source port number?

b. What is the destination port number?

c. What is the sequence number?

d. What is the acknowledgment number?

e. What is the length of header?

f. What is the type of segment?

g. What is the window size?


a. What is the source port number?

b. What is the destination port number?

c. What is the sequence number?

d. What is the acknowledgment number?

e. What is the length of header?

f. What is the type of segment?

g. What is the window size?


1.Source port - 2 bytes
2.destination port - 2 bytes
3.SEQ NUM-4 bytes
4.ACK NUM- 4 bytes
5.HLEN-1 word
6.RESERVED-6bits
7.CONTROL-6bits
8.WINDOW SIZE-2 bytes
9.CHECKSUM-2 bytes
10.URGENT POINTERS-2bytes
source port is 2 bytes take 05 32 = 1330
next 2 bytes as destination address 00 17 == 23 (default TCP port)
next 4 bytes as sequence number 00 00 00 01 ==1
next 4 bytes as ack 00 00 00 00 == 0
next 4 bits as HLEN 5 ==5 -- this indicates number of sets of 4 bytes which
makes the header lenght = 20bytes..
next 6 bits are reserved i.e.0 =0000and 2 bits from hex 0
next 6 bits are control bits = remaining 2 bits from hex 0 and 4 bits of 2
next 2 bytes indicate the window length 07 FF == 2047 bytes
Checksum 2 bytes 00 00 = 0
Urgent pointer 2bytes 00 00 =0

05 32 00 17 00 00 00 01 00 00 00 00 50 02 07 FF 00 00 00 00
Figure 24-16

TCP Segment Format


Reliable Byte-Stream Service
 Stream Data Transfer
 transfers a contiguous stream of bytes across the network,
with no indication of boundaries
 groups bytes into segments

 transmits segments as convenient (Push function defined)


 Reliability
 error control mechanism to deal with IP transfer impairments

Write 45 bytes
Application Write 15 bytes Read 40 bytes
Write 20 bytes Read 40 bytes
Transport segments

Error Detection
buffer ACKS, sequence # buffer
&
Retransmission
Flow Control
 Buffer limitations & speed mismatch can
result in loss of data that arrives at
destination
 Receiver controls rate at which sender
transmits to prevent buffer overflow

Application

Transport segments buffer used

buffer buffer available = B


advertised
window size < B
Congestion Control
 Available bandwidth to destination varies with
activity of other users
 Transmitter dynamically adjusts transmission rate
according to network congestion as indicated by
RTT (round trip time) & ACKs
 Elastic utilization of network bandwidth
Application

Transport segments
RTT buffer
ACKS buffer
Estimation
TCP Connection Establishment
Host A • “Three-way Handshake” Host B

Ack_no=Seq_no=X+1
 ISN –Initial sequence Number
 MSS- Maximum segment size
 ACK-acknowledgement
 PSH- Push-Data
 RST-Reset
 SYN-Syn
 FIN-Finished
Connection establishment using three-way handshaking

23.16
Note
A SYN segment cannot carry data, but it consumes one sequence
number.

23.17
Note
A SYN + ACK segment cannot
carry data, but does consume one
sequence number.

23.18
Note
An ACK segment, if carrying no data, consumes no sequence
number.

23.19
Near End: Connection Request
Far End: Ack and Request
Near End: Ack
Case study
 Client sends 2000 bytes of data in two
segments. The server sends 2000 bytes in
one segment.
 First three segments carry both data and ack.
 Last segments carries only ack.—there are no
more data to send.
Data transfer with error
Connection termination using three-way handshaking

23.26
Note
The FIN segment consumes one sequence number if it does
not carry data.
Note
The FIN + ACK segment consumes
one sequence number if it
does not carry data.

23.28
Data transfer- TCP
 To provide reliable delivery service to applications,TCP
uses the selective repeat ARQ with positive Ack
implemented by a sliding window mechanism.
 Suppose that at time t0 ,host B advertised window size of 2048 bytes
and next byte seq.numb is 2000. TCP entity advertise window of size
1024 bytes to host B and next byte is expected seq.num is 1
 Host A transmit up to 2048 bytes.
 At time t1 host A has only 1024 bytes to transmit with seq.num 2000.
 At time t2 A has another 1024 bytes of data and A’s sending window
closes completely.- not allowed to transmit more data until ack
comes.
 At time t3 host B has 128 bytes of data to transmit; host B can simply
piggy packing the ack.to 4048. also host B finds out it can allocate of
512 bytes.—shrink the window from 2048 to 512.
 At time t4 host A has 1024 bytes to data to transmit but it can transmit
only 512.
TCP Window Flow Control
Host A Host B

t0

1024 bytes
to transmit
t1
1024 bytes
to transmit
t2

128 bytes
to transmit
t3

1024 bytes
to transmit
t4 can only
send 512
bytes
TCP connection termination
 TCP entity in host A terminates its transmission first by
issuing FIN .seq—5086.
 Host B send ack 5087 to acknowledge the receipt of FIN.
 After B receives FIN segment ,direction of flow B to A is
still open.
 Host B sends 150 bytes in one segment.
 Host A sends an ack.
 Host B sends FIN segment.
 Host A send ack 454 to acknowledge the receipt of FIN
TCP Connection Closing
“Graceful Close”

Host A Host B

Deliver 150 bytes


TCP Segment Format
0 4 10 16 24 31

Source port Destination port

Sequence number

Acknowledgment number

U A P R S F
Header
Reserved R C S S Y I Window size
length G K H T N N

Checksum Urgent pointer

Options Padding

Data

• Each TCP segment has header of 20 or more bytes + 0 or more bytes of data
Figure 24-15

UDP Datagram Format


Example-1 :
Given a DUMP of a UDP header in hexadecimal format 06 32 00 0D 00 1C
E2 17. Find the following:-
1. Source port number?

2. Destination port number?

3. Length of user datagram?

4. Length of the data?


1.Source Port –
Source Port is 2 Byte long field used to identify the port number of
the source. The source port number is the first four hexadecimal
digits i.e. 06 32 if we convert hexadecimal to decimal we get 1586.
2.Destination Port –
It is a 2 Byte long field, used to identify the port of the destined
packet. The destination port number is the second four
hexadecimal digits 00 0D if we convert hexadecimal to decimal we
get 13
3.Length –
Length is the length of UDP including the header and the data. It is
a 16-bits field. The third four hexadecimal digits 00 1C if we
convert hexadecimal to decimal we get 16 define the length of the
whole UDP packet as 28
4.Length of the header –
It is 8 bytes as it is fixed. The length of the data is the length of the
whole packet — the length of the header i.e. 28 – 8 = 20 bytes.
UDP versus IP
IP addresses versus port numbers

TCP/IP Protocol Suite 38


Ports are nothing but Socket i.e. Entry
and Exit Point to the Layer.

Total No. Ports 0 – 65535


Reserved Ports 0 – 1023
Open Ports 1024 – 65535
Note:

The well-known port numbers are less


than 1024.

40
Examples of Networking Services
Service Port No.

HTTP 80

FTP 21

SMTP 25

TELNET 23

TFTP 69
Note:

UDP length =
IP length − IP header’s length

42
Pseudoheader for checksum calculation

43
Checksum calculation of a simple UDP user datagram

44
UDP Checksum Calculation
0 8 16 31

Source IP Address UDP


pseudo-
Destination IP Address
header
00000000 Protocol = 17 UDP Length

 UDP checksum detects for end-to-end errors


 Covers pseudoheader followed by UDP datagram
 IP addresses included to detect against misdelivery
 IP & UDP checksums set to zero during calculation
 Pad with 1 byte of zeros if UDP length is odd
UDP Receiver Checksum
 UDP receiver recalculates the checksum and silently
discards the datagram if errors detected
 “silently” means no error message is generated
 The use of UDP checksums is optional
 But hosts are required to have checksums enabled

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy