851 likes | 1.07k Views
Networking. Application Layer. Networking – Application Layer. The Application Layer is the top-most layer in the OSI model, and the Internet Protocol Stack The Application Layer defines how to exchange messages between distributed systems. Networking – Application Layer.
E N D
Networking Application Layer
Networking – Application Layer • The Application Layer is the top-most layer in the OSI model, and the Internet Protocol Stack • The Application Layer defines how to exchange messages between distributed systems
Networking – Application Layer • In terms of the Internet Protocol Stack, the OSI Application Layer, Presentation Layer and Session Layer are considered one layer; the Application Layer
Networking – Application Layer • The principal protocols in the (Internet) Application layer are • HTTP • SMTP • FTP • Sockets is a technology for inter-process communication across a network (could be considered a Session Layer protocol)
Networking – Application Layer • An Application Layer protocol defines • The types of messages exchanged, e.g., request messages and response messages; • The syntax of the various message types, i.e., the fields in the message • The semantics of the fields, i.e., the meaning of the information in the fields • Rules for determining when and how a process sends messages and responds to messages
Networking – Application Layer Application Layer Transport Layer
Networking – Application Layer • A protocol like HTTP depends on sockets • Sockets form the API for the application • API – Application Programmers Interface • The actual transport protocol used ”beneath” sockets is of no concern to HTTP
Networking – Application Layer • What can HTTP specifically do…? • HTTP defines how a client can request Web pages from a server, and how the server transfers Web pages back to the client • The client could be a Web browser • The server could be a Web server • What is a Web page actually…?
Networking – Application Layer • A Web page is a ”document” consisting of several objects • An object is just a file, like • A HTML file (.html) • An image (.jpg, .gif,…) • An audio file (.mp3,…) • …
Networking – Application Layer • Typical Web page consists of • A base HTML file • Several additional file objects • All objects can be referred to by their URL • URL – Uniform Resource Locator
Networking – Application Layer • Basic browser operation • User clicks on a hyperlink • Browser sends HTTP request messages to the server • Server receives request messages • Server responds with HTTP response messages, containing the requested objects • All communication done via sockets
Networking – Application Layer • A HTTP request (example)
Networking – Application Layer This is a GET command
Networking – Application Layer This is the object we want
Networking – Application Layer The HTTP version used by the client
Networking – Application Layer The server should close the connection after responding
Networking – Application Layer The type of the client
Networking – Application Layer The type of objects the client will accept in response
Networking – Application Layer The preferred version of the returned object
Networking – Application Layer • Note that • Request message is just a string, in plain ASCII text • Message does not have a fixed length • Specific request method can be GET, POST, HEAD • Entity body used if user e.g. has filled out a form • Additional types of header lines exist, e.g. to enable caching of objects
Networking – Application Layer • A HTTP response (example)
Networking – Application Layer The HTTP version used by the server
Networking – Application Layer Status code (200: Everything went fine)
Networking – Application Layer Status text
Networking – Application Layer The server will close the connection after responding
Networking – Application Layer When was the response created and sent
Networking – Application Layer The type of the server
Networking – Application Layer When was the requested object last modified
Networking – Application Layer How large (in bytes) is the returned object
Networking – Application Layer What type is the returned object
Networking – Application Layer The returned object itself
Networking – Application Layer • Note that • Response message is a string, in plain ASCII text, followed by the object as ”raw” bytes • Message does not have a fixed length • Additional types of header lines exist
Networking – Application Layer • Examples of status codes Seen that before…?
Networking – Application Layer • Before the client and server start to communicate, two questions must be considered • What specific transport protocol should be used? • Should persistent or non-persistent connections be used?
Networking – Application Layer • The choice of transport protocol is essentially a choice between TCP and UDP • The main TCP properties • Guaranteed data delivery • Error-free data delivery • Ordered data delivery • Adaptive transmission speed • Congestion control
Networking – Application Layer • UDP offers none of these properties, BUT • Can potentially be much faster • No ”pausing” • Any sort of error-correction, etc becomes the responsi-bility of the application
Networking – Application Layer • In the context of the World Wide Web, the TCP protocol is the preferred choice • Unacceptable (and complicated) for a Web browser to reply on an error-prone protocol like UDP • A different story for e.g. the client of a multiplayer online game…
Networking – Application Layer • HTTP also offers the choice between so-called persistent and non-persistent connections • HTTP 1.0 default: Non-persistent • HTTP 1.1 default: Persistent
Networking – Application Layer • Communication using non-persistent connection • HTTP client connects to server • Client sends HTTP request message • Server sends HTTP response to client • Server closes its connection • Client receives response, and closes connection • If more communication needed, repeat 1-5
Networking – Application Layer • Communication using persistent connection • HTTP client connects to server • Client sends HTTP request message • Server sends HTTP response to client • Client receives response • If more communication needed, repeat 2-4 • Server closes connection after a certain idle time
Networking – Application Layer • Using persistent connections does use more resources on the server side • However, network traffic is reduced • Today, persistent connection with pipelining is the preferred choice
Networking – Application Layer • Pipelining – allowing the client to issue requests without waiting for repsonse to previous reuqests • Fewer ”round-trips” between client and server, speeding up the resulting transmission rate significantly • Basic protocol properties are preserved!
Networking – Application Layer • How does a client application ”connect” to a server application? • Two pieces of information are needed • The IP address of the host machine (the machine on which the server application runs) • An identifier that specifies the server application we wish to communicate with. This is often called the port number
Networking – Application Layer • How is an IP address obtained…? • Might be known directly, or… • …using a DNS (Domain Name Server) • A DNS is capable of ”translating” human-friendly host names (www.cnn.com) to IP addresses (157.166.226.26)
Networking – Application Layer • DNS is like a gigantic ”Internet phonebook” • Many applications – inclu-ding browsers – will use DNS to translate host names to IP addresses, before sending HTTP requests • Where is this phonebook…?
Networking – Application Layer • Maybe one single gigantic database…? • Single point-of-failure • Response time • Traffic volume • Maintenance • Not feasible…