0% found this document useful (0 votes)
42 views20 pages

Section 2 - Networks

The document discusses two principal Internet transport protocols: TCP and UDP. TCP provides reliable, in-order delivery of data with congestion control and flow control. UDP provides an unreliable datagram service with no guarantees and no frills. The document also summarizes the key services provided by TCP and UDP, such as reliable data transfer, flow control, and congestion control. Transport layer protocols use port numbers and IP addresses to direct data to the appropriate socket process, known as demultiplexing.

Uploaded by

sherifasker2
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)
42 views20 pages

Section 2 - Networks

The document discusses two principal Internet transport protocols: TCP and UDP. TCP provides reliable, in-order delivery of data with congestion control and flow control. UDP provides an unreliable datagram service with no guarantees and no frills. The document also summarizes the key services provided by TCP and UDP, such as reliable data transfer, flow control, and congestion control. Transport layer protocols use port numbers and IP addresses to direct data to the appropriate socket process, known as demultiplexing.

Uploaded by

sherifasker2
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/ 20

AinShams University

Faculty of Engineering

CSE 351s: Computer networks


Section 2 Class textbook:
Computer Networking: A Top-
Down Approach (8th ed.)
Eng. Noha Wahdan J.F. Kurose, K.W. Ross
Pearson, 2020
http://gaia.cs.umass.edu/kurose_ross
Two principal Internet transport protocols
application
transport

▪ TCP: Transmission Control Protocol mobile network


network
data link
physical
• reliable, in-order delivery national or global ISP

• congestion control
• flow control
• connection setup
local or
▪ UDP: User Datagram Protocol regional ISP

• unreliable, unordered delivery home network content


• no-frills extension of “best-effort” IP provider
network datacenter
application
network
▪ services not available: transport
network
data link

• delay guarantees physical

• bandwidth guarantees enterprise


network

Transport Layer: 3-2


Services of transport layer protocols
TCP service UDP service
- Unreliable transfer
- Reliably transfer data
reliable (loss-free) transport - Recover dropped packets
- Best effort service (but no
guarantees)

flow control provide doesn’t provide

congestion control provide doesn’t provide

Timing guarantee doesn’t provide doesn’t provide

Min throughput guarantee doesn’t provide doesn’t provide

doesn’t provide doesn’t provide


security
Faster and simpler
Sheet 2: Question 1
For a communication session between a pair of processes, which process is
the client and which is the server?

▪ The process which initiates the communication is the client.


▪ The process that waits to be contacted is the server.
Sheet 2: Question 3
Suppose you wanted to do a transaction from a remote client to a server as
fast as possible. Would you use UDP or TCP? Why?

You would use UDP.


With UDP, the transaction can be completed in one roundtrip time (RTT) -
the client sends the transaction request into a UDP socket, and the server
sends the reply back to the client's UDP socket.
With TCP, a minimum of two RTTs are needed - one to set-up the TCP
connection, and another for the client to send the request, and for the
server to send back the reply.
Sheet 2: Question 4
▪ Why do HTTP, SMTP, and IMAP run on top of TCP rather than on
UDP?

The applications associated with those protocols require that all application data
be received in the correct order and without gaps. TCP provides this service
whereas UDP does not.
Sheet 4: Question 5
▪ Is it possible for an application to enjoy reliable data transfer even
when the application runs over UDP? If so, how?

Yes. The application developer can put reliable data transfer into the application
layer protocol.
However, this would require a significant amount of work and debugging.
Sheet 4: Question 3
▪ Describe why an application developer might choose to run an
application over UDP rather than TCP

An application developer may not want its application to use TCP’s congestion
control, which can throttle the application sending rate at times of congestion.
Often, designers of IP telephony and IP video-conference applications choose to
run their applications over UDP because they want to avoid TCP’s congestion
control. Also, some applications do not need the reliable data transfer provided
by TCP.
Sheet 4: Question 4
▪ Why is it that voice and video traffic is often sent over TCP rather
than UDP in today’s Internet?

Since most firewalls are configured to block UDP traffic, using TCP for video and
voice traffic lets the traffic through the firewalls.
Socket programming
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

Application Layer: 2-10


Multiplexing/demultiplexing
multiplexing at sender: demultiplexing at receiver:
handle data from multiple use header info to deliver
sockets, add transport header received segments to correct
(later used for demultiplexing) socket

application

application P1 P2 application socket


P3 transport P4
process
transport network transport
network link network
link physical link
physical physical

Transport Layer: 3-11


How demultiplexing works
▪ host receives IP datagrams 32 bits
• each datagram has source IP source port # dest port #
address, destination IP address
• each datagram carries one other header fields
transport-layer segment
• each segment has source, application
destination port number data
▪ host uses IP addresses & port (payload)
numbers to direct segment to
appropriate socket TCP/UDP segment format

Transport Layer: 3-12


Sheet 2: Question 2
What information is used by a process running on one host to identify a
process running on another host?

The IP address of the destination host and the port number of the socket in
the destination process.
Sheet 4: Question 2
▪ Consider a TCP connection between Host A and Host B. Suppose that
the TCP segments traveling from Host A to Host B have source port
number x and destination port number y. What are the source and
destination port numbers for the segments traveling from Host B to
Host A?

• Source port number y


• destination port number x
UDP demultiplexing
DatagramSocket
serverSocket = new
DatagramSocket
DatagramSocket mySocket2 = DatagramSocket mySocket1 =
new DatagramSocket (6428); new DatagramSocket (5775);
(9157); application
application application
P1
P3 P4
transport
transport transport
network
network link network
link physical link
physical physical

source port: 6428 source port: 6428


dest port: 9157 dest port: 5775

source port: 9157 source port: 5775


dest port: 6428 dest port: 6428
Transport Layer: 3-15
TCP demultiplexing
application
application P4 P5 P6 application
P1 P2 P3
transport
transport transport
network
network link network
link physical link
physical server: IP physical
address B

host: IP source IP,port: B,80 host: IP


address A dest IP,port: A,9157 source IP,port: C,5775 address C
dest IP,port: B,80
source IP,port: A,9157
dest IP, port: B,80
source IP,port: C,9157
dest IP,port: B,80
Three segments, all destined to IP address: B,
dest port: 80 are demultiplexed to different sockets
Transport Layer: 3-16
▪ How is a UDP socket fully identified? What about a TCP socket?
What is the difference between the full identification of both sockets?

▪ A UDP socket is identified by:


1. Destination IP address
2. Destination port number

▪ A TCP socket is identified by:


1. Source IP address
2. Source port number
3. Destination IP address
4. Destination port number
Sheet 4: Question 6
▪ Suppose a process in Host C has a UDP socket with port number 6789. Suppose
both Host A and Host B each send a UDP segment to Host C with destination
port number 6789. Will both segments be directed to the same socket at Host
C? If so, how will the process at Host C know that these two segments
originated from two different hosts?

Yes, both segments will be directed to the same socket.


For each received segment, at the socket interface, the operating system will
provide the process with the IP addresses to determine the origins of the
individual segments
Sheet 4: Question 7
▪ Suppose that a Web server runs in Host C on port 80. Suppose this Web
server uses persistent connections and is currently receiving requests
from two different Hosts, A and B. Are all the requests being sent through
the same socket at Host C? If they are being passed through different
sockets, do both sockets have port 80? Discuss and explain

For each persistent connection, the Web server creates a separate “connection
socket”. Each connection socket is identified with the four tuples. When it receives
a segment, it examines its four fields and determines to which socket it should pass
the payload. Thus, the requests from A and B pass through different sockets.
The identifier for both sockets has 80 for the destination port; however, the
identifiers for these sockets have different values for source IP addresses.
Thanks

You might also like