Title: Application Layer Socket API, HTTP, VoIP, DNS
1Application LayerSocket API, HTTP, VoIP, DNS
- IS250
- Spring 2010
- John Chuang
2Application Layer Socket API
end-to-end
Appl
Appl
Software
Socket API
end-to-end
Trans port
Trans port
Operating System
point-to-point
Net work
Net work
Net work
Net work
point-to-point
Link
Link
Link
Link
Hardware
Host A
Host B
Router 1
Router 2
3Socket
- Socket an API (application programming
interface) that allows the abstraction of the
underlying network (i.e., layers 4 and lower) - Sockets support send and receive methods
- Sockets identified by ltIP addr, TCP/UDP portgt
- Two common types of sockets
- Stream socket (supported by TCP)
- Datagram socket (supported by UDP)
- Read Comer 3.13-3.23
4Network Layers
- Application (layer 7) specific to application
need - Transport (layer 4) end-to-end delivery,
congestion and flow control - Network (layer 3) addressing, routing
- Data Link (layer 2) framing, error detection
- Physical (layer 1) bits (0/1), voltages,
frequencies, wires, pins,
5Representation v. Transfer
- Application layer protocols specify two aspects
of interaction - Data representation Syntax of data items that
are exchanged, e.g., HTML - Data transfer Interaction between client and
server, e.g., HTTP
6L7 Alphabet Soup
- Applications
- HTTP (Comer 4.4-4.10)
- FTP (Comer 4.11)
- Email, SMTP (Comer 4.12-4.16)
- telnet, SSH
- RTP, SIP (Comer 29)
-
- Network support
- DNS (Comer 4.17-4.25)
- BGP, RIP, OSPF (Comer 27)
7Hypertext Transfer Protocol
- HTTP specification (RFC 2616)
- http//www.ietf.org/rfc/rfc2616.txt
- HTTP uses TCP
- Two types of HTTP messages
- HTTP Request
- HTTP Response
HTTP Request
HTTP Response
Client
Server
8HTTP Request Format
ltmethodgtltresource identifiergtltHTTP versiongtltCRLFgt
Request line
ltHeadergtltvaluegtltCRLFgt
General header
Request header
ltHeadergtltvaluegtltCRLFgt
Entity header
ltCRLFgt
Blank line
Message body
Entity body
- Note
- ltCRLFgt carriage-return-line-feed
- optional fields in
9HTTP Header Fields
- Entity Headers
- Allow
- Content-Encoding
- Content-Language
- Content-Length
- Content-Location
- Content-MD5
- Content-Range
- Content-Type
- Expires
- Last-Modified
- HTTP Methods
- GET
- POST
- HEAD
- OPTIONS
- PUT
- DELETE
- TRACE
- CONNECT
- General Header Fields
- Cache-Control
- Connection
- Date
- Pragma
- Trailer
- Transfer-Encoding
- Upgrade
- Via
- Request Headers
- Accept
- Accept-Charset
- Accept-Encoding
- Accept-Language
- Authorization
- Cookie
- Expect
- From
- Host
- If-Match If-Modified-Since
- If-None-Match
- If-Range
- If-Unmodified-Since
- Max-Forwards
- Proxy-Authorization
- Range
- Referrer
- TE
Mandatory in HTTP/1.1
10HTTP Request Example
GET /index.html HTTP/1.1ltCRLFgt
Request line
Host www.sims.berkeley.edu ltCRLFgt
Request header
ltCRLFgt
Blank line
11HTTP Response
- Note
- ltCRLFgt carriage-return-line-feed
- optional fields in
ltHTTP versiongtltstatus codegtltReason phrasegtltCRLFgt
Status line
General header
ltHeadergtltvaluegtltCRLFgt
Response header
Entity header
ltCRLFgt
Blank line
Message body
Entity body
- Response Header Fields
- Accept-Ranges
- Age
- Etag
- Location
- Proxy-Authenticate
- Retry-After
- Server
- Set-Cookie
- Vary
- WWW-Authenticate
- Status Codes
- 1xx Informational
- 2xx Success
- 3xx Redirection
- 4xx Client error
- 5xx Server error
- Some common codes
- 200 OK
- 401 Unauthorized
- 404 Not Found
12HTTP Response Example
Status line
HTTP/1.1 200 OK Date Mon, 12 Nov 2007 201404
GMT Server Apache/2.0.52 (Red Hat) X-Powered-By
PHP/4.3.9 Set-Cookie PHPSESSIDf49e0b5ec
expiresWed, 05-Dec-2007 234724 GMT
path/ Last-Modified Mon, 12 Nov 2007 201404
GMT Cache-Control no-store, no-cache,
must-revalidate Cache-Control post-check0,
pre-check0 Pragma no-cache Transfer-Encoding
chunked Content-Type text/html
charsetutf-8 lthtml xmlns"http//www.w3.org/1999
/xhtml" lang"en" xmllang"engt lt/htmlgt
General header
Response header
Entity header
Blank line
Entity body
13HTTP/1.1 and Persistent TCP Connections
- An HTML object often has other embedded objects
(e.g., images) - HTTP/1.0 requires a new TCP session for each
object - Overhead of session establishment
- HTTP/1.1 permits reuse of one TCP session for
multiple requests - Use Connection Keep-Alive header
14L7 Alphabet Soup
- Applications
- HTTP (Comer 4.4-4.10)
- FTP (Comer 4.11)
- Email, SMTP (Comer 4.12-4.16)
- telnet, SSH
- RTP, SIP (Comer 29)
-
- Network support
- DNS (Comer 4.17-4.25)
- BGP, RIP, OSPF (Comer 27)
15Real-Time Multimedia
- How to support real-time multimedia applications
(e.g., video, audio) over a best-effort IP
network? - Packets may be delivered out of order or lost
- Retransmission is too slow to be helpful
- Technique delayed playback using timestamps and
jitter buffer
Source Douglas Comer
16Real-Time Transport Protocol (RTP)
- Protocol for transport of real-time multi-media
data - Sequence number and timestamp in RTP header
Source Douglas Comer
17Real-Time Transport Protocol (RTP)
- RTP messages encapsulated in UDP datagrams
- Why not TCP?
Source Douglas Comer
18RTP Companion Protocols
- RTCP Real-time Transport Control Protocol
- Control packets sent periodically to report
quality such as loss rate and jitter - RTSP Real-time Transport Streaming Protocol
- Used by streaming media players to provide remote
control like capabilities (e.g., play, stop, fast
forward)
19IP Telephony (VoIP)
- Companies around the world are replacing
traditional telephone switches with IP routers - Routers cost much less than traditional telephone
switches - Sending both data and voice as IP packets lowers
cost because underlying infrastructure is shared - The basic idea behind IP telephony
- continuously sample audio, convert to digital
(PCM) - send digitized stream across IP network (RTP)
- convert stream back to analog for playback
- Complications arise in signaling and backward
compatibility with PSTN
20IP Telephony (VoIP)
- IP telephone
- Media gateway controller
- Media gateway
- Signaling gateway
Source Douglas Comer
21VoIP Protocols
- RTP for user multimedia data
- Multiple protocols for signaling
- SIP Session Initiation Protocol RFC 2543
(IETF) - H.323 (ITU)
- ENUM converts telephone number to URI
facilitates DNS lookup
Source Douglas Comer
22Example SIP Session
Source Douglas Comer
23L7 Alphabet Soup
- Applications
- HTTP (Comer 4.4-4.10)
- FTP (Comer 4.11)
- Email, SMTP (Comer 4.12-4.16)
- telnet, SSH
- RTP, SIP (Comer 29)
-
- Network support
- DNS (Comer 4.17-4.25)
- BGP, RIP, OSPF (Comer 27)
24Domain Name Service (DNS)
- Routers and end-hosts use IP addresses
- e.g., 128.32.226.87
- Human beings remember hostnames
- e.g., ischool.berkeley.edu
- Need translation service!
- Client sends query message (hostname) to domain
name server using UDP - Name server sends response message (with resolved
IP address) back to client
25DNS Query
Local Name Server (ns1.berkeley.edu)
(1)
(2)
(3)
Client (client.ischool.berkeley.edu)
Server (www.publisher.com)
26DNS Query
Root Name Server (f.root-servers.net)
Local Name Server (ns1.berkeley.edu)
(2)
Remote Name Server (ns.publisher.com)
(3)
(4)
(5)
(1)
(6)
(7)
Client (client.ischool.berkeley.edu)
Server (www.publisher.com)
27Hostnames a-m.root-servers.net Source
http//www.wia.org/pub/rootserv.html
28Next Time Overlays
- Build your own networks at the application layer