Download presentation
Presentation is loading. Please wait.
Published byJoshua Carroll Modified over 6 years ago
1
Application layer 1 Principles of network applications 2 Web and HTTP
3 FTP 4 Electronic Mail 5 DNS 2: Application Layer
2
Application architectures
Client-server Peer-to-peer (P2P) Hybrid of client-server and P2P 2: Application Layer
3
Client-server architecture
In client-server architecture there is an always-on host called server Which services requests from many other hosts called clients Clients do not directly communicate with each other Server has a fixed well-known address called an IP address A single server host is incapable of keeping up with all the requests from its clients Ex. News website server can quickly become overload if it has only one server handling all of its requests For this reason clusters of hosts sometime referred to as a server farm are often used to create a powerful virtual server in client server architecture
4
Client-server architecture
always-on host (called server) permanent IP address server farms for scaling clients: communicate with server may be intermittently connected may have dynamic IP addresses do not communicate directly with each other client/server 2: Application Layer
5
Pure P2P architecture no always-on server
arbitrary end systems directly communicate with each other Pair of hosts called peers peers are intermittently connected and change IP addresses Peers communicate without passing through some special server Highly scalable but difficult to manage peer-peer 2: Application Layer
6
Hybrid of client-server and P2P
Client server and P2P are two common architectures for network applications However many applications are organized as hybrids of the client server and P2P architecture 2: Application Layer
7
Processes communicating
Process: program running within a host. Process can be thought of as a program that is running within end system within same host, two processes communicate using inter-process communication (defined by OS). processes in different hosts communicate by exchanging messages Client process: process that initiates communication Server process: process that waits to be contacted Note: applications with P2P architectures have client processes & server processes 2: Application Layer
8
Sockets process sends/receives messages to/from its socket
socket analogous to door 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 Process is analogous to a house and socket is analogous to its door process TCP with buffers socket host or server process TCP with buffers socket host or server Internet controlled by OS 2: Application Layer
9
Addressing processes to receive messages, process must have identifier
host device has unique 32-bit IP address Q: does IP address of host on which process runs be enough for identifying the process? A: No, many processes can be running on same host identifier includes both IP address and port numbers associated with process on host. Example port numbers: HTTP server: 80 Mail server: 25 to send HTTP message to web server: IP address: Port number: 80 2: Application Layer
10
Application layer 2.1 Principles of network applications
app architectures app requirements 2.2 Web and HTTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P applications 2.7 Socket programming with TCP 2.8 Socket programming with UDP 2: Application Layer
11
Web and HTTP First some jargon Web page consists of objects
Object can be HTML file, JPEG image, Java applet, audio file,… Web page consists of base HTML-file which includes several referenced objects Each object is addressable by a URL Example URL: host name path name 2: Application Layer 11
12
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 HTTP request PC running Explorer HTTP response HTTP request Server running Apache Web server HTTP response Mac running Navigator 2: Application Layer
13
HTTP overview (continued)
Uses TCP: client initiates TCP connection (creates socket) to server 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 2: Application Layer
14
The first line of an HTTP request message is called the request line
The subsequent lines are called the header lines The request line has three fields The method field, the URL field, & the HTTP version field The method field can take on several different values including GET, POST, HEAD But the majority of HTTP request messages use the GET method (used when browser request an object)
15
HTTP request message two types of HTTP messages: request, response
ASCII (human-readable format) Cr: carriage return and Lf: Line feed with each element separated by SP characters. No CR or LF is allowed except in the final CRLF sequence. request line (GET, POST, HEAD commands) GET /somedir/page.html HTTP/1.1 Host: User-agent: Mozilla/4.0(browser type) Connection: close (it doesn’t need persistent connection) Accept-language:fr (prefers french version otherwise default version) (extra carriage return, line feed) header lines Carriage return, line feed indicates end of message 2: Application Layer
16
HTTP request message: general format
2: Application Layer
17
FTP: the file transfer protocol
user interface client file transfer FTP server user at host remote file system local file system transfer file to/from remote host client/server model client: side that initiates transfer (either to/from remote) server: remote host ftp server: port 21 2: Application Layer
18
FTP: separate control, data connections
FTP uses two parallel TCP connections to transfer a file Control connection & Data connection The control connection is used for sending control information between two hosts such as a user identification, password etc The data connection is used to actually send a file 2: Application Layer 18
19
FTP: separate control, data connections
client server TCP control connection port 21 TCP data connection port 20 FTP client contacts FTP server at port 21, TCP is transport protocol client authorized over control connection (ID & Password) client browses remote directory by sending commands over control connection. when server receives file transfer command, server opens 2nd TCP connection (for file) to client after transferring one file, server closes data connection. server opens another TCP data connection to transfer another file. FTP server maintains “state”: current directory, earlier authentication 2: Application Layer
20
Electronic Mail: SMTP messages must be in 7-bit ASCII
uses TCP to reliably transfer message from client to server, port 25 direct transfer: sending server to receiving server three phases of transfer handshaking (greeting) transfer of messages closure command/response interaction commands: ASCII text response: status code and phrase messages must be in 7-bit ASCII 2: Application Layer
21
Scenario: Alice sends message to Bob
1) Alice uses UA to compose message and “to” 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 (SMTP handshaking) 5) Bob’s mail server places the message in Bob’s mailbox 6) Bob invokes his user agent to read message at his convenience mail server mail server 1 user Agent/Bob' user Agent/Alice 2 3 6 4 5 2: Application Layer
22
SMTP: final words Comparison with HTTP:
SMTP uses persistent connections SMTP requires message (header & body) to be in 7-bit ASCII SMTP server uses CRLF.CRLF to determine end of message Comparison with HTTP: HTTP: pull SMTP: push both have ASCII command/response interaction HTTP: each object encapsulated in its own response msg SMTP: multiple objects sent in multipart msg 2: Application Layer
23
Both protocols are used to transfer files from one host to another
Comparison with HTTP Both protocols are used to transfer files from one host to another HTTP transfer files from a web server to a web client (a browser) SMTP transfer files (that is messages) from one mail server to another mail server When transferring the files both persistent HTTP & SMTP use persistent connections HTTP is mainly a pull protocol-someone loads information on a web server & users use HTTP to pull the information from the server at their convenience 2: Application Layer 23
24
SMTP is primarily a push protocol
Comparison with HTTP SMTP is primarily a push protocol The sending mail server pushes the file to the receiving mail server 2: Application Layer 24
25
Mail message format header body
SMTP: protocol for exchanging msgs standard for text message format: header lines, e.g., To: From: Subject: different from SMTP commands! body the “message”, ASCII characters only header blank line body 2: Application Layer
26
DNS: Domain Name System
People: many identifiers: Internet hosts, routers: IP address (32 bit) - used for addressing datagrams “name”, e.g., ww.yahoo.com - used by humans 2: Application Layer
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.