HTTP overview(continued) uses TCP: HTTP is“stateless" client initiates TCP 。server maintains no connection(creates socket) information about to server,port 80 past client requests server accepts TCP connection from client aside HTTP messages protocols that maintain (application-layer protocol state"are complex! messages)exchanged past history(state)must be between browser(HTTP maintained client)and Web server if server/client crashes,their (HTTP server) views of“state”may be TCP connection closed inconsistent,must be reconciled Application Layer2-21
Application Layer2-21 HTTP overview (continued) uses TCP: ▪ client initiates TCP connection (creates socket) to server, port 80 ▪ server accepts TCP connection from client ▪ HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server) ▪ TCP connection closed HTTP is “stateless” ▪ server maintains no information about past client requests protocols that maintain “ state ” are complex! ▪ past history (state) must be maintained ▪ if server/client crashes, their views of “ state ” may be inconsistent, must be reconciled aside
HTTP connections non-persistent HTTP persistent HTTP at most one object sent over multiple objects can TCP connection be sent over single connection then closed TCP connection downloading multiple objects between client,server required multiple connections Application Layer2-22
Application Layer2-22 HTTP connections non-persistent HTTP ▪ at most one object sent over TCP connection • connection then closed ▪ downloading multiple objects required multiple connections persistent HTTP ▪ multiple objects can be sent over single TCP connection between client, server
Non-persistent HTTP suppose user enters URL: (contains text, www.someSchool.edu/someDepartment/home.index references to 10 jpeg images) Ia.HTTP client initiates TCP connection to HTTP server (process)at Ib.HTTP server at host www.someSchool.edu on port www.someSchool.edu waiting 80 for TCP connection at port 80. 'accepts"connection,notifying 2.HTTP client sends HTTP reguest client message(containing URL)into TCP connection socket. 3.HTTP server receives request Message indicates that client message,forms response wants object message containing requested someDepartment/home.index object,and sends message into its socket time Application Layer2-23
Application Layer2-23 Non-persistent HTTP suppose user enters URL: 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) www.someSchool.edu/someDepartment/home.index
Non-persistent HTTP(cont.) 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 Application Layer2-24
Application Layer2-24 Non-persistent 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
Non-persistent HTTP:response time RTT (definition):time for a small packet to travel from client to server and back HTTP response time: initiate TCP one RTT to initiate TCP connection connection RTT. one RTT for HTTP request request file and first few bytes of HTTP RTT time to response to return transmit file file transmission time file non-persistent HTTP received response time 2RTT+file transmission time time time Application Layer2-25
Application Layer2-25 Non-persistent HTTP: response time RTT (definition): time for a small packet to travel from client to server and back HTTP 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 ▪ non-persistent HTTP response time = 2RTT+ file transmission time time to transmit file initiate TCP connection RTT request file RTT file received time time