Chapter 2 Application Layer Computer Networking A Top

  • Slides: 21
Download presentation
Chapter 2 Application Layer Computer Networking: A Top Down Approach Featuring the Internet, 3

Chapter 2 Application Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley, July 2004. All material copyright 1996 -2005 J. F Kurose and K. W. Ross, All Rights Reserved 2: Application Layer 1

Some network apps r E-mail r Internet telephone r Web r Real-time video r

Some network apps r E-mail r Internet telephone r Web r Real-time video r Instant messaging r Remote login r P 2 P file sharing r Multi-user network games r Streaming stored video clips conference r Massive parallel computing r r r 2: Application Layer 2

Creating a network app Write programs that v v v run on different end

Creating a network app Write programs that v v v run on different end systems and communicate over a network. e. g. , Web: Web server software communicates with browser software little software written for devices in network core v v network core devices do not run user application code application on end systems allows for rapid app development, propagation application transport network data link physical 2: Application Layer 3

Client-server architecture server: v v v always-on host permanent IP address server farms for

Client-server architecture server: v v v always-on host permanent IP address server farms for scaling clients: v v v communicate with server may have dynamic IP addresses do not communicate directly with each other 2: Application Layer 4

Processes communicating Process: program running within a host. r within same host, two processes

Processes communicating Process: program running within a host. r within same host, two processes communicate using inter-process communication (defined by OS). r processes in different hosts communicate by exchanging messages Client process: process that initiates communication Server process: process that waits to be contacted 2: Application Layer 5

Sockets r process sends/receives messages to/from its socket r socket analogous to door v

Sockets r process sends/receives messages to/from its socket r socket analogous to door v v sending process shoves message out door sending process relies on transport infrastructure on other side of door which brings message to socket at receiving process host or server process controlled by app developer process socket TCP with buffers, variables Internet TCP with buffers, variables controlled by OS r API: (1) choice of transport protocol; (2) ability to fix a few parameters (lots more on this later) 2: Application Layer 6

Addressing processes r For a process to receive messages, it must have an identifier

Addressing processes r For a process to receive messages, it must have an identifier r A host has a unique 32 bit IP address r Q: does the IP address of the host on which the process runs suffice for identifying the process? r Answer: No, many processes can be running on same host r Identifier includes both the IP address and port numbers associated with the process on the host. r Example port numbers: v v HTTP server: 80 Mail server: 25 r More on this later 2: Application Layer 7

App-layer protocol defines r Types of messages exchanged, e. g. , request & response

App-layer protocol defines r Types of messages exchanged, e. g. , request & response messages r Syntax of message types: what fields in messages & how fields are delineated r Semantics of the fields, i. e. , meaning of information in fields r Rules for when and how processes send & respond to messages 2: Application Layer 8

What transport service does an app need? Data loss r some apps (e. g.

What transport service does an app need? Data loss r some apps (e. g. , audio) can tolerate some loss r other apps (e. g. , file transfer, telnet) require 100% reliable data transfer 2: Application Layer 9

Internet transport protocols services TCP service: r connection-oriented: setup r r required between client

Internet transport protocols services TCP service: r connection-oriented: setup r r 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: r unreliable data transfer between sending and receiving process r does not provide: connection setup, reliability, flow control, congestion control, timing, or bandwidth guarantee Q: why bother? Why is there a UDP? 2: Application Layer 10

Internet apps: application, transport protocols Application e-mail remote terminal access Web file transfer streaming

Internet apps: application, transport protocols Application e-mail remote terminal access Web file transfer streaming multimedia Internet telephony Application layer protocol Underlying transport protocol SMTP [RFC 2821] Telnet [RFC 854] HTTP [RFC 2616] FTP [RFC 959] proprietary (e. g. Real. Networks) proprietary (e. g. , Vonage, Dialpad) TCP TCP TCP or UDP typically UDP 2: Application Layer 11

Web and HTTP First some jargon r Web page consists of objects r Object

Web and HTTP First some jargon r Web page consists of objects r Object can be HTML file, JPEG image, Java applet, audio file, … r Web page consists of base HTML-file which includes several referenced objects r Each object is addressable by a URL r Example URL: www. someschool. edu/some. Dept/pic. gif host name path name 2: Application Layer 12

HTTP overview HTTP: hypertext transfer protocol r Web’s application layer protocol r client/server model

HTTP overview HTTP: hypertext transfer protocol r Web’s application layer protocol r client/server model v client: browser that requests, receives, “displays” Web objects v server: Web server sends objects in response to requests r HTTP 1. 0: RFC 1945 r HTTP 1. 1: RFC 2068 HT TP req ues PC running HT t TP res Explorer pon se st ue q e r P nse Server T o p running HT es r P T Apache Web HT server Mac running Navigator 2: Application Layer 13

HTTP overview (continued) Uses TCP: r client initiates TCP connection (creates socket) to server,

HTTP overview (continued) Uses TCP: r client initiates TCP connection (creates socket) to server, port 80 r server accepts TCP connection from client r HTTP messages (applicationlayer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server) r TCP connection closed HTTP is “stateless” r server maintains no information about past client requests aside Protocols that maintain “state” are complex! r past history (state) must be maintained r if server/client crashes, their views of “state” may be inconsistent, must be reconciled 2: Application Layer 14

HTTP request message r two types of HTTP messages: request, response r HTTP request

HTTP request message r two types of HTTP messages: request, response r HTTP request message: v ASCII (human-readable format) request line (GET, POST, HEAD commands) GET /somedir/page. html HTTP/1. 1 Host: www. someschool. edu User-agent: Mozilla/4. 0 header Connection: close lines Accept-language: fr Carriage return, line feed indicates end of message (extra carriage return, line feed) 2: Application Layer 15

HTTP request message: general format 2: Application Layer 16

HTTP request message: general format 2: Application Layer 16

HTTP response message status line (protocol status code status phrase) header lines data, e.

HTTP response message status line (protocol status code status phrase) header lines data, e. g. , requested HTML file HTTP/1. 1 200 OK Connection close Date: 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. . . 2: Application Layer 17

HTTP response status codes In first line in server->client response message. A few sample

HTTP response status codes In first line in server->client response message. A few sample codes: 200 OK v request succeeded, requested object later in this message 301 Moved Permanently v requested object moved, new location specified later in this message (Location: ) 400 Bad Request v request message not understood by server 404 Not Found v requested document not found on this server 505 HTTP Version Not Supported 2: Application Layer 18

FTP: the file transfer protocol user at host FTP user client interface file transfer

FTP: the file transfer protocol user at host FTP user client interface file transfer local file system FTP server remote file system r transfer file to/from remote host r client/server model client: side that initiates transfer (either to/from remote) v server: remote host r ftp: RFC 959 r ftp server: port 21 v 2: Application Layer 19

FTP: separate control, data connections TCP control connection port 21 r FTP client contacts

FTP: separate control, data connections TCP control connection port 21 r FTP client contacts FTP r r server at port 21, specifying TCP as transport protocol Client obtains authorization over control connection Client browses remote directory by sending commands over control connection. When server receives a command for a file transfer, the server opens a TCP data connection to client After transferring one file, server closes connection. FTP client TCP data connection port 20 FTP server r Server opens a second TCP data connection to transfer another file. r Control connection: “out of band” r FTP server maintains “state”: current directory, earlier authentication 2: Application Layer 20

FTP commands, responses Sample commands: Sample return codes r sent as ASCII text over

FTP commands, responses Sample commands: Sample return codes r sent as ASCII text over r status code and phrase (as control channel r USER username r PASS password r LIST return list of file in r r current directory r RETR filename retrieves r r STOR filename stores r (gets) file (puts) file onto remote host in HTTP) 331 Username OK, password required 125 data connection already open; transfer starting 425 Can’t open data connection 452 Error writing file 2: Application Layer 21