CS F303 (Computer Networks) : Vishal Gupta
CS F303 (Computer Networks) : Vishal Gupta
(Computer Networks)
Vishal Gupta
Department of Computer Science and Information Systems
BITS Pilani Birla Institute of Technology and Science
Pilani|Dubai|Goa|Hyderabad
Pilani Campus, Pilani
DNS review
• What is the difference between Recursive Query and Iterative Query ?
COMPUTER NETWORKS 2 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
DNS name root DNS server
resolution example
2
• host at cis.poly.edu 3
TLD DNS server
wants IP address for 4
gaia.cs.umass.edu 5
gaia.cs.umass.edu
gaia.cs.umass.edu
COMPUTER NETWORKS 5 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Problem
Consider the scenario shown in
which a server is connected to a
router by a 100Mbps link with a
50ms propagation delay. Initially this
router is also connected to two
routers, each over a 25Mbps link
with a 200ms propagation delay. A
1Gbps link connects a host and a
cache (if present) to each of these
routers and we assume that this link
has 0 propagation delay. All packets
in the network are 20,000 bits long.
VISHAL GUPTA, PhD 6 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Problem
What is the end-‐to-‐end delay from
when a packet is transmitted by the
server to when it is received by the
client? In this case, we assume there
are no caches, there’s no queuing
delay at the routers, and the packet
processing delays at routers and
nodes are all 0.
VISHAL GUPTA, PhD 7 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Problem
Here we assume that client hosts
send requests for files directly to the
server (caches are not used or off in
this case). What is the maximum
rate at which the server can deliver
data to a single client if we assume
no other clients are making
requests?
VISHAL GUPTA, PhD 8 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Problem
Again we assume only one active
client but in this case the caches are
on and behave like HTTP caches. A
client’s HTTP GET is always first
directed to its local cache. 60% of
the requests can be satisfied by the
local cache. What is the average rate
at which the client can receive data
in this case?
VISHAL GUPTA, PhD 9 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Problem
What is the average end-‐to-‐end
delay for the case that 60% of the
requests can be satisfied by the
local cache?
VISHAL GUPTA, PhD 10 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
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
Application Layer 2-11 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Socket programming
Two socket types for two transport services:
– UDP: unreliable datagram
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.
Application Layer 2-12 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Socket programming with UDP
UDP: no “connection” between client & server
• no handshaking before sending data
• sender explicitly attaches IP destination address and
port # to each packet
• rcvr extracts sender IP address and port# from
received packet
UDP: transmitted data may be lost or received
out-of-order
Application viewpoint:
• UDP provides unreliable transfer of groups of bytes
(“datagrams”) between client and server
write reply to
serverSocket read datagram from
specifying clientSocket
client address,
port number close
clientSocket
Application
BITS Pilani, Deemed to be University under Section 3 of UGC Act,2-14
1956
Example app: UDP client
Python UDPClient
include Python’s socket
library
from socket import *
serverName = ‘hostname’
serverPort = 12000
create UDP socket for clientSocket = socket(socket.AF_INET,
server
write reply to
connectionSocket read reply from
clientSocket
close
connectionSocket close
clientSocket
sentence = connectionSocket.recv(1024)
read bytes from socket (but
not address as in UDP) capitalizedSentence = sentence.upper()
close connection to this connectionSocket.send(capitalizedSentence)
client (but not welcoming
socket) connectionSocket.close()
Application Layer 2-20
BITS Pilani
Pilani|Dubai|Goa|Hyderabad