Professional Documents
Culture Documents
COMPUTER NETWORKS
Textbooks:
1. Computer-Networks- Andrew S. Tanenbaum and David J. Wetherall, Pearson Education,
5th-Edition. (www.pearsonhighered.com/tanenbaum)
2. Computer Networking A Top-Down Approach -James F. Kurose and Keith W.
RossPearson Education 7th Edition.
Reference Books:
1. Behrouz A Forouzan, Data and Communications and Networking, Fifth Edition, McGraw
Hill,Indian Edition
2. Larry L Peterson and Brusce S Davie, Computer Networks, fifth edition, ELSEVIER
(As per VTU Syllabus)
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
CREDITS – 4 (3 T + 2 L)
CIE (Continuous Internal Evaluation) MARKS – 50
SEE (Semester End Examination) MARKS – 50
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Course Outcomes:
CO1. Learn the basic needs of communication system.
CO2. Interpret the communication challenges and its solution.
CO3. Identify and organize the communication system
network components
CO4. Design communication networks for user requirements.
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Assessment Details (both CIE and SEE)
3/3/2024 ELAIYARAJA P
Program Outcomes:
PROGRAM OUTCOMES
PO's PO Description
Engineering knowledge: Apply the knowledge of mathematics, science, engineering
PO1 fundamentals, and an engineering specialization to the solution of complex
engineering problems.
Problem analysis: Identify, formulate, review research literature, and analyze
PO2 complex engineering problems reaching substantiated conclusions using first
principles of mathematics, natural sciences, and engineering sciences.
Design/development of solutions: Design solutions for complex engineering
problems and design system components or processes that meet the specified needs
PO3
with appropriate consideration for the public health and safety, and the cultural,
societal, and environmental considerations.
Conduct investigations of complex problems: Use research-based knowledge and
PO4 research methods including design of experiments, analysis and interpretation of
data, and synthesis of the information to provide valid conclusions.
Modern tool usage: Create, select, and apply appropriate techniques, resources, and
PO5 modern engineering and IT tools including prediction and modeling to complex
engineering activities with an understanding of the limitations.
The engineer and society: Apply reasoning informed by the contextual knowledge
PO6 to assess societal, health, safety, legal and cultural issues and the consequent
responsibilities relevant to the professional engineering practice.
Environment and sustainability: Understand the impact of the professional
PO7 engineering solutions in societal and environmental contexts, and demonstrate the
knowledge of, and need for sustainable development.
Ethics: Apply ethical principles and commit to professional ethics and
PO8
responsibilities and norms of the engineering practice.
3/3/2024 ELAIYARAJA P
Program Outcomes:
Individual and team work: Function effectively as an individual, and as a member
PO9
or leader in diverse teams, and in multidisciplinary settings.
Communication: Communicate effectively on complex engineering activities with
the engineering community and with society at large, such as, being able to
PO10
comprehend and write effective reports and design documentation, make effective
presentations, and give and receive clear instructions.
Project management and finance: Demonstrate knowledge and understanding of
the engineering and management principles and apply these to one’s own work, as a
PO11
member and leader in a team, to manage projects and in multidisciplinary
environments.
Life-long learning: Recognize the need for, and have the preparation and ability to
PO12 engage in independent and life-long learning in the broadest context of technological
change.
3/3/2024 ELAIYARAJA P
Program Specific Outcomes:
3/3/2024 ELAIYARAJA P
21CS52 –
COMPUTER NETWORKS
3/3/2024 ELAIYARAJA P
Module 4 –
The Transport Layer
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
❖ transport-layer ❖ connection-oriented
services transport: TCP
❖ multiplexing and ▪ segment structure
demultiplexing ▪ reliable data transfer
❖ connectionless ▪ flow control
transport: UDP ▪ connection management
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Protocol Suite Module 4 - The Transport Layer
HTTP SMTP DNS RTP
Distributed
applications User
Reliable
TCP UDP datagram
stream
service service
Diverse network
technologies
Best-effort
IP (ICMP, ARP)
connectionless
packet transfer
processes running on
different hosts
❖ transport protocols run in
end systems
▪ send side: breaks app
messages into segments,
passes to network layer
application
▪ rcv side: reassembles transport
network
segments into messages, data link
physical
passes to app layer
❖ more than one transport
protocol available to apps
▪ Internet: TCP and UDP
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
Transport Service Primitives
Socket programming
goal: learn how to build client/server applications that
communicate using sockets
socket: door between application process and end-end-transport
protocol
application application
socket controlled by
process process app developer
transport transport
network network controlled
link by OS
link Internet
physical physical
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
Transport Service Primitives
Socket programming
Two socket types for two transport services:
▪ UDP: unreliable datagram
▪ TCP: reliable, byte stream-oriented
Application Example:
1. Client reads a line of characters (data) from its keyboard
and sends the data to the server.
2. The server receives the data and converts characters to
uppercase.
3. The server sends the modified data to the client.
4. The client receives the modified data and displays the line
on its screen.
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
We will use the term segment for messages sent from transport entity to
transport entity.
TCP, UDP and other Internet protocols use this term. Thus, segments
(exchanged by the transport layer) are contained in packets (exchanged by the
network layer). In turn, these packets are contained in frames (exchanged by
the data link layer). When a frame arrives, the data link layer processes the
frame header and, if the destination address matches for local delivery, passes
the contents of the frame payload field up to the network entity. The network
entity similarly processes the packet header and then passes the contents of the
packet payload up to the transport entity.
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
Berkeley Sockets
The socket primitives as they are used for TCP. Sockets were first released as part of
the Berkeley UNIX 4.2BSD software distribution in 1983. They quickly became
popular.
The primitives are now widely used for Internet programming on many operating
systems, especially UNIX-based systems, and there is a socket-style API for
Windows called ‘‘winsock.’’
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
Transport Service Primitives
Types of Sockets :
There are two types of Sockets: the datagram socket and
the stream socket.
FUNCTION CALL DESCRIPTION
Create() To create a socket
Bind() It’s a socket identification like a
telephone number to contact
Listen() Ready to receive a connection
Connect() Ready to act as a sender
Accept() Confirmation, it is like accepting
to receive a call from a sender
Write() To send data
Read() To receive data
Close() To close a connection
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
Multiplexing/demultiplexing
multiplexing at sender:
handle data from multiple demultiplexing at receiver:
sockets, add transport header use header info to deliver
(later used for demultiplexing) received segments to correct
socket
application
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
Connectionless demultiplexing
❖ recall: created socket has ❖ recall: when creating
host-local port #: datagram to send into UDP
DatagramSocket mySocket1 = new socket, must specify
DatagramSocket(12534);
▪ destination IP address
▪ destination port #
Connection-oriented demux
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
UDP: User Datagram Protocol
▪ UDP use:
▪ streaming multimedia apps (loss tolerant, rate sensitive)
▪ DNS
▪ SNMP
▪ HTTP/3
▪ if reliable transfer needed over UDP (e.g., HTTP/3):
▪ add needed reliability at application layer
▪ add congestion control at application layer
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
UDP: Transport Layer Actions
application application
transport transport
(UDP) (UDP)
link link
physical physical
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
UDP: Transport Layer Actions
SNMP server
SNMP client
UDP sender actions:
application
SNMP msg
application ▪ is passed an application-
layer message transport
transport UDP
UDPhh SNMP msg
▪ determines UDP (UDP)
(UDP) segment header fields
values network (IP)
network (IP) ▪ creates UDP segment
▪ passes segment to IP link
link
physical
physical
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
UDP: Transport Layer Actions
SNMP server
SNMP client
UDP receiver actions:
▪ receives segment from IP application
application
▪ checks UDP checksum transport
transport header value
SNMP msg (UDP)
(UDP) ▪ extracts application-layer
message network (IP)
network
UDP (IP)
h SNMP msg ▪ demultiplexes message link
link up to application via
socket physical
physical
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
UDP segment header
32 bits
source port # dest port #
length checksum
data to/from
UDP segment format application layer
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
UDP pseudo-header
0 8 16 31
Source IP Address
Destination IP Address
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
TCP seq. numbers, ACKs
The diagram
shows the
establishment of a
new connection to
a web server - the
Gateway Server.
The first three
packets are part of
the 3-way
handshake
performed by TCP
before any data is
transferred
between the two
hosts.
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
TCP seq. numbers, ACKs : STEP 1
Host A wishes to download a webpage from the Gateway Server. This requires a new
connection between the two to be established so Host A sends a packet to the Gateway
Server. This packet has the SYN flag set and also contains the ISN generated by Host
A's operating system, that is 1293906975. Since Host A is initiating the connection and
hasn't received a reply from the Gateway Server, the Acknowledgment number is set to
zero (0).
In short, Host A is telling the Gateway Server the following: "I'd like to initiate a new
connection with you. My Sequence number is 1293906975".
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
TCP seq. numbers, ACKs : STEP 2
The Gateway Server receives Host A's request and generates a reply containing its own
generated ISN, that is 3455719727, and the next Sequence number it is expecting from
Host A which is 1293906976. The Server also has the SYN & ACK flags set,
acknowledging the previous packet it received and informing Host A of its own
Sequence number.
In short, the Gateway Server is telling Host A the following: "I acknowledge your
sequence number and expecting your next packet with sequence number 1293906976. My
sequence number is 3455719727".
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
TCP seq. numbers, ACKs : STEP 3
Host A receives the reply and now knows Gateway's sequence number. It generates
another packet to complete the connection. This packet has the ACK flag set and also
contains the sequence number that it expects the Gateway Server to use next, that is
3455719728.
In short, Host A is telling the Gateway Server the following: "I acknowledge your last
packet. This packet's sequence number is 1293906976, which is what you're expecting. I'll
also be expecting the next packet you send me to have a sequence number of
3455719728".
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
TCP seq. numbers, ACKs
Now, you might be expecting the next packet to be sent from
the Gateway Server, but this is not the case. You might recall
that Host A initiated the connection because it wanted to download a
web page from the Gateway Server. Since the 3-way TCP
handshake has been completed, a virtual connection between the
two now exists and the Gateway Server is ready to listen to Host
A's request.
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
TCP seq. numbers, ACKs
In this step, Host A generates a packet with some data and sends it to the Gateway
Server. The data tells the Gateway Server which webpage it would like sent.
Note that the sequence number of the segment in line 4 is the same as in line 3
because the ACK does not occupy sequence number space.
So keep in mind that any packets generated, which are simply acknowledgments (in
other words, have only the ACK flag set and contain no data) to previously received
packets, never increment the sequence number.
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
User
types
‘C’ Seq=42, ACK=79, data = ‘C’
host ACKs
receipt of
‘C’, echoes
Seq=79, ACK=43, data = ‘C’ back ‘C’
host ACKs
receipt
of echoed
‘C’ Seq=43, ACK=80
3/3/2024 ELAIYARAJA P
18CS52 - Computer Networks and Security
Module -2 Transport Layer
Connection Management
before exchanging data, sender/receiver “handshake”:
❖ agree to establish connection (each knowing the other willing
to establish connection)
❖ agree on connection parameters (e.g., starting seq #s)
application application
network network
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
Congestion Control
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
R R
▪ no retransmissions needed
Host
B
R/2
Q: What happens as
lout
delay
throughput:
approaches R/2?
lin R/2 lin R/2
maximum per-connection large delays as arrival
throughput: R/2 rate lin approaches
capacity
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
R R
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
lout
▪ sender sends only when router buffers available
throughput:
Host A lin : original data lin
lout R/2
copy l'in: original data, plus
retransmitted data
R R
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
no buffer space!
R R
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
lout
to full buffers
throughput:
when sending at
▪ sender knows when packet has been R/2, some
dropped: only resends if packet known to be packets are
lost needed
retransmissions
Host A lin : original data lin R/2
l'in: original data, plus
retransmitted data
R R
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
lout
▪ packets can be lost, dropped at router due to “wasted” capacity
due to un-needed
full buffers – requiring retransmissions retransmissions
throughput:
▪ but sender times can time out prematurely,
when sending at
sending two copies, both of which are R/2, some packets
delivered are
retransmissions,
Host A lin : original data lin
including needed
and un-needed
timeou R/2
copy
t l'in: original data, plus duplicates, that are
retransmitted data delivered!
R R
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
lout
“wasted” capacity
due to un-needed
▪ packets can be lost, dropped at router due to retransmissions
throughput:
full buffers – requiring retransmissions
when sending at
▪ but sender times can time out prematurely, R/2, some packets
sending two copies, both of which are are
retransmissions,
delivered including needed
lin R/2 and un-needed
duplicates, that are
“costs” of congestion: delivered!
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
Host
D
lout
Host
C
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
lin’ R/2
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
throughput: lout
lin R/2
delay
R/2
lin R/2
lout
▪ loss/retransmission decreases effective
throughput:
throughput
lin R/2 R/2
throughput: lout
effective throughput
R/2
lin R/2
lout
buffering wasted for packets lost
downstream lin’ R/2
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
TCP congestion control: AIMD
▪ approach: senders can increase sending rate until packet loss
(congestion) occurs, then decrease sending rate on loss event
Additive Increase
Multiplicative Decrease
increase sending rate by 1 cut sending rate in half at
maximum segment size every each loss event
RTT until loss detected
TCP sender Sending rate
AIMD sawtooth
behavior: probing
for bandwidth
time
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
TCP AIMD:
Why AIMD?
▪ AIMD – a distributed, asynchronous algorithm – has
been shown to:
• optimize congested flow rates network wide!
• have desirable stability properties
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
RTT
• double cwnd every RTT
• done by incrementing cwnd
for every ACK received
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
TCP fairness
TCP connection 1
bottleneck
TCP connection 2 router
capacity R
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
RTP runs on top of UDP
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
RTP header
payload sequence Synchronization Miscellaneo
time stamp
type number type Source ID us fields
sequence # (16 bits): increment by one for each RTP packet sent
❖ detect packet loss, restore packet sequence
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
RTP header
payload sequence Synchronization Miscellaneous
time stamp
type number type Source ID fields
▪ timestamp field (32 bits long): sampling instant of first byte in this
RTP data packet
• for audio, timestamp clock increments by one for each
sampling period (e.g., each 125 usecs for 8 KHz sampling
clock)
• if application generates chunks of 160 encoded samples,
timestamp increases by 160 for each RTP packet when source
is active. Timestamp clock continues to increase at constant
rate when source is inactive.
▪ SSRC field (32 bits long): identifies source of RTP stream. Each
stream in RTP session has distinct SSRC
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
Real-Time Control Protocol (RTCP)
▪ works in conjunction with RTP ▪ each RTCP packet contains sender
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
RTCP: multiple multicast senders
sender RTP
RTCP
RTCP
RTCP
receivers
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
Sequence number
Acknowledgment number
Header U A P R S F
Reserved R C S S Y I Window size
length G K H T N N
Options Padding
Data
• Each TCP segment has header of 20 or more bytes + 0 or more bytes of data
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
TCP seq. numbers, ACKs outgoing segment from sender
sequence numbers: source port # dest port #
sequence number
▪byte stream “number” of acknowledgement number
data
checksum urg pointer
window size
acknowledgements: N
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
TCP Header
Port Numbers Sequence Number
A socket identifies a Byte count
connection endpoint First byte in segment
IP address + port 32 bits long
A connection specified by a 0 SN 232-1
socket pair Initial sequence number
Well-known ports selected during connection
FTP 20 setup
Telnet 23
DNS 53
HTTP 80
3/3/2024 P ELAIYARAJA
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
TCP Header
Acknowledgement Number Header length
SN of next byte expected by 4 bits
receiver Length of header in multiples
Acknowledges that all prior of 32-bit words
bytes in stream have been Minimum header length is 20
received correctly bytes
Valid if ACK flag is set Maximum header length is 60
bytes
3/3/2024 P ELAIYARAJA
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
TCP Header
Reserved Control
6 bits 6 bits
URG: urgent pointer flag
Urgent message end = SN + urgent pointer
ACK: ACK packet flag
PSH: override TCP buffering
RST: reset connection
Upon receipt of RST, connection is terminated
and application layer notified
SYN: establish connection
FIN: close connection
3/3/2024 P ELAIYARAJA
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
TCP Header
Window Size TCP Checksum
16 bits to advertise window Internet checksum method
size TCP pseudoheader + TCP
Used for flow control segment
Sender will accept bytes with
SN from ACK to ACK +
window
Maximum window size is
65535 bytes
3/3/2024 P ELAIYARAJA
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
0 8 16 31
Source IP address
Destination IP address
TCP pseudo-header
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
3/3/2024 ELAIYARAJA P
21CS52 - COMPUTER NETWORKS
Module 4 - The Transport Layer
THE END
3/3/2024 ELAIYARAJA P