Professional Documents
Culture Documents
Application Layer
Computer Networks
The slides are made by J.F Kurose and K.W. Ross,
adapted by Phuong Vo and Tan Le
clients:
communicate with server
client/server
may be intermittently
connected
may have dynamic IP
addresses
do not communicate directly
with each other
application application
socket controlled by
process process app developer
transport transport
network network controlled
link
by OS
link Internet
physical physical
application underlying
application layer protocol transport protocol
time
6. Steps 1-5 repeated for each of 10
jpeg objects
2-26
Example 1 (Problem 8)
Suppose that the Web page associated with the link
contains exactly one object, consisting of a small
amount of HTML text which references to eight very
small objects on the same server. Let RTT0 denote
the RTT between the local host and server.
Neglecting transmission times, how much time
elapses with
a. Non-persistent HTTP with no parallel TCP
connections?
b. Non-persistent HTTP with the browser configured
for 5 parallel connections?
c. Persistent HTTP?
Application Layer 2-27
Example 1 - answer
a) 2RTT0 + 8*2RTT0
= 18RTT0
b) 2RTT0 + 2* (RTT0 + RTT0)
= 6RTT0
c) Persistent connection with pipelining. This is the
default mode of HTTP
2RTT0 + RTT0 = 3RTT0
Persistent connection without pipelining, without
parallel connections.
2RTT0 + 8RTT0 = 10RTT0
Application Layer 2-28
Example 2 (Problem 10)
Consider a short, 10-meter link, over which a sender can
transmit at a rate of 150 bits/sec in both directions.
Suppose that packets containing data (HTML and 10
objects) are 100,000 bits long each, and packets containing
only control (e.g., ACK or handshaking) are 200 bits long.
2)Persistent HTTP:
(200/150+Tp + 200/150 + Tp + 200/150 +
Tp + 100,000/150 + Tp )
+
10 * (200/(150/10) + Tp +
100,000/(150/10)+ Tp )
=7351 + 24 * Tp (seconds)
URL method:
uses GET method
input is uploaded in URL
field of request line:
https://google.com/search?q=monkeys+and+banana
Shopee 8734
usual http request msg Tiki server
cookie file creates ID
usual http response
1678 for user create backend
Shopee 8734
set-cookie: 1678 entry database
Tiki 1678
usual http request msg
cookie: 1678 cookie- access
specific
usual http response msg action
… …
gaia.cs.umass.edu
gaia.cs.umass.edu
type=A type=CNAME
name is hostname name is alias name for some
value is IP address “canonical” (the real) name
www.ibm.com is really
type=NS
name is domain (e.g., servereast.backup2.ibm.com
foo.com) value is canonical name
value is hostname of
authoritative name type=MX
server for this domain
value is name of mailserver
associated with name
2 bytes 2 bytes
identification flags
application application
socket controlled by
process process app developer
transport transport
network network controlled
link
by OS
link Internet
physical physical
Application Example:
1. client reads a line of characters (data) from its
keyboard and sends data to server
2. server receives the data and converts characters to
uppercase
3. server sends modified data to client
4. client receives modified data and displays line on
its screen
Application Layer 2-76
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
receiver 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 2-78
Example app: UDP client
Python UDPClient
include Python’s socket
library from socket import *
serverName = ‘hostname’
serverPort = 12000
create UDP socket for clientSocket = socket(AF_INET,
server
SOCK_DGRAM)
get user keyboard
input message = raw_input(’Input lowercase sentence:’)
Attach server name, port to clientSocket.sendto(message.encode(),
message; send into socket
(serverName, serverPort))
read reply characters from modifiedMessage, serverAddress =
socket into string
clientSocket.recvfrom(2048)
print out received string print modifiedMessage.decode()
and close socket
clientSocket.close()
Application Layer 2-79
Example app: UDP server
Python UDPServer
from socket import *
serverPort = 12000
create UDP socket serverSocket = socket(AF_INET, SOCK_DGRAM)
bind socket to local port
number 12000
serverSocket.bind(('', serverPort))
print (“The server is ready to receive”)
loop forever while True:
Read from UDP socket into message, clientAddress = serverSocket.recvfrom(2048)
message, getting client’s
address (client IP and port) modifiedMessage = message.decode().upper()
send upper case string serverSocket.sendto(modifiedMessage.encode(),
back to this client clientAddress)
write reply to
connectionSocket read reply from
clientSocket
close
connectionSocket close
clientSocket
Internet
… …
…
manifest file
…
where’s Madmen?
… …
Application Layer 2-97
CDN content access: a closer look
Bob (client) requests video http://netcinema.com/6Y7B23V
video stored in CDN at http://KingCDN.com/NetC6y&B23V
1. Bob manages
Netflix account CDN
server
4. DASH streaming