Presentation is loading. Please wait.

Presentation is loading. Please wait.

9/16/2003-9/18/2003 The Application Layer and Java Programming September 16-18, 2003.

Similar presentations


Presentation on theme: "9/16/2003-9/18/2003 The Application Layer and Java Programming September 16-18, 2003."— Presentation transcript:

1 9/16/2003-9/18/2003 The Application Layer and Java Programming September 16-18, 2003

2 9/16/2003-9/18/2003 Assignments Homework 2 –Chapter 2 review Finish 2.1-2.2 and 2.6-1.8 Read 2.3-2.5 and 2.9

3 9/16/2003-9/18/2003 Application Layer Goals –Understand application-layer concepts and protocols Real examples – HTTP, FTP, SMTP –Understand application development Socket programming –CDNs (if time)

4 9/16/2003-9/18/2003 Application Communication Web Browser Web Server

5 9/16/2003-9/18/2003 Jargon Process – running program Application-layer protocol – defines communication between processes –HTTP User agent – entity that interfaces with the user and network –Web browser

6 9/16/2003-9/18/2003 Applications and App-Layer Protocols Web Browser Web Server HTTP UI HTTP … File Access

7 9/16/2003-9/18/2003 Protocol Stack Web Browser HTTP UI Application Transport Network Link Physical

8 9/16/2003-9/18/2003 Protocols Define –Types of messages exchanged request/response –Syntax of message types what fields in messages & how fields are delineated –Semantics of the fields meaning of information in fields –Rules for when and how processes send & respond to messages Public-domain protocols –defined in RFCs –allow for interoperability –HTTP, SMTP Proprietary protocols –KaZaA

9 9/16/2003-9/18/2003 Client-Server Paradigm application transport network data link physical application transport network data link physical Client initiates contact with server typically requests service from server Web: client implemented in browser Server provides requested service to client Web: server sends requested Web page request reply

10 9/16/2003-9/18/2003 Sockets Interface between app and transport layers Send/receive messages to/from socket API –choice of transport protocol –ability to fix a few parameters (buffer size, etc) process TCP with buffers, variables socket host or server process TCP with buffers, variables socket host or server Internet controlled by OS controlled by app developer

11 9/16/2003-9/18/2003 Sockets Application Transport Network Link Physical Socket

12 9/16/2003-9/18/2003 Addressing Need ID for receiving host –Unique 32-bit IP address

13 9/16/2003-9/18/2003 Addressing Need ID for receiving host –Unique 32-bit IP address Need to differentiate between processes –Port number (HTTP is typically port 80)

14 9/16/2003-9/18/2003 Port Number TCP Web ServerMail Server IP = 138.110.1.1 Port = 25 Port = 80

15 9/16/2003-9/18/2003 Transport-layer Services Reliability –Do I always need all of my packets to get there? Bandwidth –Do I need a minimum bw guarantee? Timing –Can my messages be delayed?

16 9/16/2003-9/18/2003 App Protocols and Transport Protocols Application e-mail remote terminal access Web file transfer streaming multimedia Internet telephony Application layer protocol SMTP [RFC 2821] Telnet [RFC 854] HTTP [RFC 2616] FTP [RFC 959] proprietary (e.g. RealNetworks) proprietary (e.g., Dialpad) Underlying transport protocol TCP TCP or UDP typically UDP

17 9/16/2003-9/18/2003 Web and HTTP Web page consists of objects –HTML file, JPEG image, Java applet, audio file,… Example –www.mtholyoke.edu/~srollins/www.mtholyoke.edu/~srollins/ URL: www.someschool.edu/someDept/pic.gif host name path name

18 9/16/2003-9/18/2003 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 Server is stateless PC running Explorer Server running Apache Web server Mac running Navigator HTTP request HTTP response

19 9/16/2003-9/18/2003 HTTP PC running Explorer TCP Open ? OK HTTP GET … Data TCP Close

20 9/16/2003-9/18/2003 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

21 9/16/2003-9/18/2003 Nonpersistent HTTP TCP Open ? OK HTTP GET index.htm Data TCP Close TCP Open ? OK HTTP GET sami.jpg Data TCP Close

22 9/16/2003-9/18/2003 Response Time Modeling RTT – time to send a small packet to travel from client to server and back. Response time –one RTT to initiate TCP connection –one RTT for HTTP request and first few bytes of HTTP response to return –file transmission time Total = 2RTT+transmit time time to transmit file initiate TCP connection RTT request file RTT file received time

23 9/16/2003-9/18/2003 Persistent HTTP TCP Open ? OK HTTP GET index.htm Data HTTP GET sami.jpg Data TCP Close

24 9/16/2003-9/18/2003 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

25 9/16/2003-9/18/2003 HTTP Request Message two types of HTTP messages: request, response HTTP request message: –ASCII (human-readable format) GET /somedir/page.html HTTP/1.1 Host: www.someschool.edu User-agent: Mozilla/4.0 Connection: close Accept-language:fr (extra carriage return, line feed) request line (GET, POST, HEAD commands) header lines Carriage return, line feed indicates end of message

26 9/16/2003-9/18/2003 Request General Format

27 9/16/2003-9/18/2003 Input POST method Web page often includes form input Input is uploaded to server in entity body URL method Uses GET method Input is uploaded in URL field of request line

28 9/16/2003-9/18/2003 Method Types HTTP/1.0 GET POST HEAD –asks server to leave requested object out of response HTTP/1.1 GET, POST, HEAD PUT –uploads file in entity body to path specified in URL field DELETE –deletes file specified in the URL field

29 9/16/2003-9/18/2003 HTTP Response Message 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 data data data... status line (protocol status code status phrase) header lines data, e.g., requested HTML file

30 9/16/2003-9/18/2003 HTTP Response Status 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

31 9/16/2003-9/18/2003 User-Server Interaction Server may want to identify users –Why?

32 9/16/2003-9/18/2003 Authorization –control access to server content Credentials –typically name, password Stateless –client must present authorization in each request client server usual http request msg 401: authorization req. WWW authenticate: usual http request msg + Authorization: usual http response msg usual http request msg + Authorization: usual http response msg time

33 9/16/2003-9/18/2003 Cookies Four components –1) cookie header line in the HTTP response message –2) cookie header line in HTTP request message –3) cookie file kept on user’s host and managed by user’s browser –4) back-end database at Web site Example: –Susan access Internet always from same PC –She visits a specific e- commerce site for first time –When initial HTTP requests arrives at site, site creates a unique ID and creates an entry in backend database for ID

34 9/16/2003-9/18/2003 Cookies: Example client server usual http request msg usual http response + Set-cookie: 1678 usual http request msg cookie: 1678 usual http response msg usual http request msg cookie: 1678 usual http response msg cookie- specific action cookie- spectific action server creates ID 1678 for user entry in backend database access Cookie file amazon: 1678 ebay: 8734 Cookie file ebay: 8734 Cookie file amazon: 1678 ebay: 8734 one week later:

35 9/16/2003-9/18/2003 Conditional GET Goal: don’t send object if client has up- to-date cached version client: specify date of cached copy in HTTP request –If-modified-since: server: response contains no object if cached copy is up-to- date: –HTTP/1.0 304 Not Modified client server HTTP request msg If-modified-since: HTTP response HTTP/1.0 304 Not Modified object not modified HTTP request msg If-modified-since: HTTP response HTTP/1.0 200 OK object modified

36 9/16/2003-9/18/2003 Assignments Finish reading chapter 2 for next week Finish up Lab 1

37 9/16/2003-9/18/2003 FTP FTP client contacts FTP 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 FTP server TCP control connection port 21 TCP data connection port 20 Server opens a second TCP data connection to transfer another file. Control connection: out of band FTP server maintains “state”: current directory, earlier authentication

38 9/16/2003-9/18/2003 Electronic Mail Three major components –user agents –mail servers –simple mail transfer protocol: SMTP user mailbox outgoing message queue mail server user agent user agent user agent mail server user agent user agent mail server user agent SMTP

39 9/16/2003-9/18/2003 Example 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 1) Alice uses UA to compose message and “to” bob@someschool.edu 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 user agent mail server mail server user agent 1 2 3 4 5 6

40 9/16/2003-9/18/2003 Mail Access Protocols SMTP: delivery/storage to receiver’s server (push) Mail access protocol: retrieval from server –POP: Post Office Protocol authorization (agent server) and download –IMAP: Internet Mail Access Protocol more features (more complex) manipulation of stored msgs on server –HTTP: Hotmail, Yahoo! Mail, etc. user agent sender’s mail server user agent SMTP access protocol receiver’s mail server


Download ppt "9/16/2003-9/18/2003 The Application Layer and Java Programming September 16-18, 2003."

Similar presentations


Ads by Google