Computer Communication and
Networks
(CS3713)
By
Dr. Muhammad Azhar Iqbal
Department of Computer Science,
Mohammad Ali Jinnah University, Islamabad.
Lecture Outlines
Application Layer
Web and HTTP
FTP
DNS
P2P File Sharing
Network Applications
Email
Web
Instant Messaging
Remote Login
P2P file sharing
Multi-user Network game
Streaming stored video clip
Internet telephone
Real-time video conference
Massive parallel Computing
Creating Network Application
application
transport
Write programs that network
data link
physical
run on different end systems
and
communicate over a network.
e.g., Web: Web server
software communicates with
browser software application
application transport
No software written for devices transport
network
network
data link
data link
in network core physical
physical
Network core devices do not
function at app layer
This design allows for rapid
app development
Application architectures
Client-server
Peer-to-peer (P2P)
Hybrid of client-server and P2P
Client-Server Architecture
server:
– always-on host
– permanent IP address
clients:
– communicate with server
– may be intermittently connected
– may have dynamic IP addresses
– do not communicate directly with
each other
Pure P2P Architecture
no always on server
arbitrary end systems directly communicate
peers are intermittently connected and change IP addresses
example: Gnutella
Highly scalable
But difficult to manage
Hybrid of client-server and P2P
Napster
File transfer P2P
File search centralized:
Peers register content at central server
Peers query same central server to locate content
Instant messaging
Chatting between two users is P2P
Presence detection/location centralized:
User registers its IP address with central server when
it comes online
User contacts central server to find IP addresses of
buddies
What Transport Service does an Application Need
Data loss (Reliability)
- some apps (e.g., audio) can tolerate some loss
- other apps (e.g., file transfer, telnet) require 100% reliable data
transfer
Timing
- some apps (e.g., Internet telephony, interactive games) require
low delay to be “effective”
Bandwidth
- some apps (e.g., multimedia) require minimum amount of
bandwidth to be “effective”
- other apps (“elastic apps”) make use of whatever bandwidth
they get
Transport service requirements of common apps
Internet Transport Protocol Services
TCP service:
connection-oriented: setup required between client and server
processes
reliable transport between sending and receiving process
flow control: sender won’t overwhelm receiver
congestion control: throttle sender when network overloaded
does not provide: timing, minimum bandwidth guarantees
UDP service:
• unreliable data transfer between sending and receiving process
• does not provide: connection setup, reliability, flow control,
congestion control, timing, or bandwidth guarantee
Q: why bother? Why is there a UDP?
Internet Apps: Application, Transport Protocol
Web and HTTP
Web and HTTP
The WWW today is a distributed client/server service,
in which a client using a browser can access a service
using a server. However, the service provided is
distributed over many locations called sites.
URL
Web Document
The documents in the WWW can be grouped into three
broad categories: static, dynamic, and active. The category
is based on the time at which the contents of the document
are determined.
Dynamic documents are sometimes referred to as server-side
dynamic documents.
Active documents are sometimes referred to as client-side
dynamic documents.
Web Document
HTTP
The Hypertext Transfer Protocol (HTTP) is a protocol used mainly
to access data on the World Wide Web.
HTTP Transaction
Persistent vs Non-Persistent Connection
HTTP uses the services of TCP on well-known port 80.
HTTP version 1.1 specifies a persistent connection by default.
Web and HTTP
First some jargon
Web page consists of objects
Object can be HTML file, JPEG image, Java applet, audio
file,…
Web page consists of base HTML-file which includes
several referenced objects
Each object is addressable by a URL
Example URL:
[Link]/someDept/[Link]
host name path name
HTTP Overview
HTTP: HyperText Transfer Protocol
Web’s application layer protocol
client/server model
client: browser that requests, receives, “displays” Web
objects
server: Web server sends objects in response to requests
PC running
HTTP 1.0: RFC 1945 Explorer
HTTP 1.1: RFC 2068
Server
running
Apache Web
server
Mac running
Navigator
HTTP Overview
Uses TCP:
client initiates TCP connection HTTP is “stateless”
(creates socket) to server, port 80 server maintains no
information about past
server accepts TCP connection client requests
from client
HTTP messages (application-layer
aside
Protocols that maintain “state”
protocol messages) exchanged are complex!
past history (state) must be
between browser (HTTP client)
maintained
and Web server (HTTP server)
if server/client crashes, their
views of “state” may be
TCP connection closed inconsistent, must be
reconciled
HTTP Connections
Nonpersistent HTTP
At most one object is sent over a TCP connection.
HTTP/1.0 uses nonpersistent HTTP
Persistent HTTP
• Multiple objects can be sent over single TCP connection
between client and server.
• HTTP/1.1 uses persistent connections in default mode
Non-Persistent HTTP
[Link]/someDepartment/[Link]
(contains text, references to 10 jpeg images)
1a. HTTP client initiates TCP connection
to HTTP server (process) at
[Link] on port 80
1b. HTTP server at host
[Link] waiting
for TCP connection at port 80.
“accepts” connection, notifying
client
2. HTTP client sends HTTP
request message (containing
URL) into TCP connection 3. HTTP server receives request
socket. Message indicates message, forms response
that client wants object message containing requested
someDepartment/[Link] object, and sends message
into its socket
time
Non-Persistent HTTP
4. HTTP server closes TCP
connection.
5. HTTP client receives response
message containing html file,
displays html. Parsing html file,
finds 10 referenced jpeg objects
time
6. Steps 1-5 repeated for each
of 10 jpeg objects
Response Time Modeling
Definition of RTT: time for a small
packet to travel from client to
server and back.
initiate TCP
connection
Response time: RTT
one RTT to initiate TCP request
file
connection time to
one RTT for HTTP request and RTT
transmit
file
first few bytes of HTTP response file
received
to return
time time
File transmission time
total = 2RTT + transmit time
Persistent HTTP
Nonpersistent HTTP issues:
requires 2 RTTs per object
OS must work and allocate host resources for each TCP connection
but browsers often open parallel TCP connections to fetch referenced objects
Persistent HTTP
server leaves connection open after sending response
subsequent HTTP messages between same client/server are sent over
connection
Persistent without pipelining:
• client issues new request only when previous response has been received
• one RTT for each referenced object
Persistent with pipelining:
• default in HTTP/1.1
• client sends requests as soon as it encounters a referenced object
• as little as one RTT for all the referenced objects
HTTP Request Message
two types of HTTP messages: request, response
HTTP request message:
ASCII (human-readable format)
request line
(GET, POST, GET /somedir/[Link] HTTP/1.1
HEAD commands) Host: [Link]
User-agent: Mozilla/4.0
header Connection: close
lines Accept-language:fr
Carriage return, (extra carriage return, line feed)
line feed
indicates end
of message
HTTP response message
status line
(protocol
status code HTTP/1.1 200 OK
status phrase) Connection close
Date: Thu, 06 Aug 1998 [Link] GMT
Server: Apache/1.3.0 (Unix)
header
Last-Modified: Mon, 22 Jun 1998 …...
lines
Content-Length: 6821
Content-Type: text/html
data, e.g., data data data data data ...
requested
HTML file
HTTP Response Status Code
In first line in server->client response message. A few sample codes:
200 OK
request succeeded, requested object later in this
message
301 Moved Permanently
requested object moved, new location specified later
in this message (Location:)
400 Bad Request
request message not understood by server
404 Not Found
requested document not found on this server
505 HTTP Version Not Supported
Web Caches (Proxy Server)
Goal: satisfy client request without involving origin server
user sets browser: Web origin
server
accesses via cache
Proxy
browser sends all HTTP server
requests to cache client
object in cache: cache
returns object
else cache requests
object from origin server,
then returns object to client
client
Web Caches (Proxy Server)
Cache acts as both client and server
Typically cache is installed by ISP (university, company,
residential ISP)
Why Web caching?
• Reduce response time for client request.
• Reduce traffic on an institution’s access link.
• Internet dense with caches enables “poor” content providers
to effectively deliver content (but so does P2P file sharing)
Streaming Audio/Video
Streaming Audio/Video
Before audio or video signals can be sent on the Internet, they
need to be digitized and require compression.
First Approach: Using a Web Server
Second Approach: Using a Web Server with a Metafile
Third Approach: Using a Media Server
Fourth Approach: Using a Media Server and RTSP
First Approach
Streaming Audio/Video Using a Web Server
Second Approach
Streaming Audio/Video Using a Web Server with Metafile
Third Approach
Streaming Audio/Video Using a Media Server
Fourth Approach
Streaming Audio/Video Using a Media Server and RTSP
Real-Time Interactive Streaming Audio/Video
Streaming live audio/video is similar to the broadcasting of audio and
video by radio and TV stations. Instead of broadcasting to the air, the
stations broadcast through the Internet.
There are several similarities between streaming stored audio/video
and streaming live audio/video. They are both sensitive to delay;
neither can accept retransmission. However, there is a difference. In
the first application, the communication is unicast and on-demand. In
the second, the communication is multicast and live.
In real-time interactive audio/video, people communicate with one
another in real time. The Internet phone or voice over IP is an
example of this type of application. Video conferencing is another
example that allows people to communicate visually and orally.
Real-Time Interactive Streaming Audio/Video
Characteristics
Time Relationship
Jitter is introduced in real-time data by the delay between packets.
Real-Time Interactive Streaming Audio/Video
Characteristics
Jitter
Jitter is introduced in real-time data by the delay between packets.
Real-Time Interactive Streaming Audio/Video
Characteristics
Timestamp
To prevent jitter, we can time-stamp the packets and separate the arrival time from
the playback time.
Real-Time Interactive Streaming Audio/Video
Characteristics
Playback Buffer
A playback buffer is required for real-time traffic.
Real-Time Interactive Streaming Audio/Video
A sequence number on each packet is required for real-time traffic.
Real-time traffic needs the support of multicasting.
Translation means changing the encoding of a payload to a lower
quality to match the bandwidth of the receiving network.
Mixing means combining several streams of traffic into one stream.
TCP, with all its sophistication, is not suitable for interactive
multimedia traffic because we cannot allow retransmission of
packets.
UDP is more suitable than TCP for interactive traffic. However, we
need the services of RTP, another transport layer protocol, to make up
for the deficiencies of UDP.