Upload
rosalind-ward
View
225
Download
0
Tags:
Embed Size (px)
Citation preview
2
Principles of network applications
– Develping new applications -> writing software running on multiple end systems
3
Network application architecture– Network architecture– Application architecture
Client-server architecture P2P architecture
4
Client and server processes
The interface between the process and the computer network
– Application programming interface (API)
5
Transport service available to applications
– Reliable data data transfer
– Throughput: bandwidth-sensitive applications and elastic applica
tions
– Timing
– Security
6
Transport services provided by the Internet
– TCP services
Connection-oriented service: handshaking, connection establishmen
t, tearing down the connection
Reliable data transfer service
Congestion-control mechanism
– UDP services
Connectionless
No handshaking
An unreliable data transfer service
7
8
Today’s Internet can often provide satisfactory service to timesentive applica
tions, but it cannot provide any timing or bandwidth guarantees.
Addressing processes: host by IP address + process by port number
9
Application-layer protocols
– The types of messages exchanged
– The syntax of the various message types
– The semantics of the fields
– Rules for examining when and how a process a sends messages and re
sponds to messages
– e.g., HTTP – Web’s application-layer protocol
10
The Web and HTTP
Overview of HTTP– HyperText Transfer Protocol– Web page = a set of objects: an object = a file– Web browser = the client of HTTP– Web server = the server of HTTP– A stateless protocol
Non-persistent and persistent connections– HTTP with non-persistent connections
Each TCP connection is closed after the server sends the object. (next slide)
– HTTP with persistent connections The server leaves the TCP connection open after sending a respons
e.
11
Nonpersistent HTTP
Suppose user enters URL www.someSchool.edu/someDepartment/home.index
1a. HTTP client initiates TCP connection to HTTP server (process) at www.someSchool.edu on port 80
2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object someDepartment/home.index
1b. HTTP server at host www.someSchool.edu waiting for TCP connection at port 80. “accepts” connection, notifying client
3. HTTP server receives request message, forms response message containing requested object, and sends message into its socket
time
(contains text, references to 10
jpeg images)
12
Nonpersistent HTTP (cont.)
5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects
6. Steps 1-5 repeated for each of 10 jpeg objects
4. HTTP server closes TCP connection.
time
13
14
HTTP message format– Request messages and response messages– HTTP request message
GET /somedir/page.html HTTP/1.1Host: www.someschool.edu User-agent: Mozilla/4.0Connection: close Accept-language:fr
(extra carriage return, line feed)
request line(GET, POST,
HEAD commands)
Carriage return, line feed
indicates end of message
15
16
HTTP response message
HTTP/1.1 200 OK Connection closeDate: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 22 Jun 1998 …... Content-Length: 6821 Content-Type: text/html data data data data data ...
status line(protocol
status codestatus phrase)
header lines
data, e.g., requestedHTML file
17
– HTTP response message:
18
User-server interaction: Cookies– Identify users– One-click shopping; shopping cart service
19
Web caching– Web cache = proxy server– A cache is both a server and a client at the same time.
20
21
Conditional GET
Goal: don’t send object if cache has up-to-date cached version
cache: specify date of cached copy in HTTP requestIf-modified-since: <date>
server: response contains no object if cached copy is up-to-date: HTTP/1.0 304 Not Modified
cache server
HTTP request msgIf-modified-since:
<date>
HTTP responseHTTP/1.0
304 Not Modified
object not
modified
HTTP request msgIf-modified-since:
<date>
HTTP responseHTTP/1.0 200 OK
<data>
object modified
22
FTP
– Out-of-band, stateful protocol
23
Electronic Mail
Simple Mail Transfer Protocol (SMTP)
24
– The body of SMTP: 7-bit ASCII– Use persistent connections– Push protocol (cf. pull protocol e.g. HTTP)
25
1) Alice uses UA to compose message and “to” [email protected]
2) Alice’s UA sends message to her mail server; message placed in message queue
3) Client side of SMTP opens TCP connection with Bob’s mail server
4) SMTP client sends Alice’s message over the TCP connection
5) Bob’s mail server places the message in Bob’s mailbox
6) Bob invokes his user agent to read message
26
Mail Message Formats and MIME– Multipurpose Internet Mail Extensions (MIME)
Content-Type Content-Transfer-Encoding
Mail Access Protocols
– Post Office Protocol - Verson 3 (POP3), Internet Mail Acess Protocol (IMAP), and HTTP
27
DNS – The Internet’s Directory Service
– Domain name system– Identifer: hostname, IP address– Translate hostnames to IP addresses– Host aliasing: canonical hostname– Mail server aliasing– Load distribution: DNS rotation– A centralized design
A single point of failure Traffic volume Distant centralized database Maintenance
28
A distributed, hierachical database– Root DNS servers– Top-level domain (TLD) servers– Authoritative DNS servers
29
30
31
32
– DNS caching: cache the mapping in its local memory
DNS records and messages– Resource records (RRs)– RR: (Name, Value, Type, TTL)– Type = A: hostanme and its IP address– Type = NS: domain and hostname of an authoritative DNS server– Type = CNAME: cananical hostname– Type = MX: canaonical name of a mail server
33
34
Inserting records into the DNS database– Registrar– Internet Corporation for Assigned Names and Numbers (ICANN)
35
Peer-to-Peer Applications
– Peers vs service providers– File distribution, organizing and searching for information and Int
ernet telephony application
P2P file distribution– Scalability of P2P architectures
36
BitTorrent– File distribution– Torrent: the collection of all peers participating in the distribution of a par
ticular file– Chungs of a file (256KBytes)– Each torrent has an infrasturecture node called a tracker– Rarest first: from neighbors– Trading algorithm: gives priority to the neighbors that are currently suppl
ying data at the highest rate– Four top peers and one probing peer– Free-riding
37
38
Searching for information in a P2P community– Information index – a mapping of information to host locations– File sharing: files to peers– Instant message: username to locations (IP addresses)– Centralized index
Napster A hybird of P2P and client-server architecture Copyright infringement
39
– Query flooding Gnutella The index is fully distributed over the community peers Overlay network Limited-scope query flooding New peers join: bootstrap problem
40
Gnutella: Peer joining
1. joining peer Alice must find another peer in Gnutella network: use list of candidate peers
2. Alice sequentially attempts TCP connections with candidate peers until connection setup with Bob
3. Flooding: Alice sends Ping message to Bob; Bob forwards Ping message to his overlay neighbors (who then forward to their neighbors….)
peers receiving Ping message respond to Alice with Pong message
4. Alice receives many Pong messages, and can then setup additional TCP connections
41
– Hierarchical overlay FastTrack, Kazaa and Morpheus Limited-scope flooding in the overlay network of super peers
42
Case study: P2P Internet Telephony with Skype– Real time– P2P for user location and for NAT traversal
43
P2P Case study: Skype
P2P (pc-to-pc, pc-to-phone, phone-to-pc) Voice-Over-IP (VoIP) application
– also IM proprietary application-layer
protocol (inferred via reverse engineering)
hierarchical overlay
Skype clients (SC)
Supernode (SN)
Skype login server
44
Skype: making a call
User starts Skype
Skype login server
SC registers with SN– list of bootstrap SNs
SC logs in (authenticate)
Call: SC contacts SN will callee ID– SN contacts other SNs (unknown protocol, maybe flooding) to find addr of callee; returns addr to
SC
SC directly contacts callee, overTCP