Download Application Layer

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Application Layer
FTP (File Transfer Protocol) &
Telnet
Transport Layer and Port Numbers
Email client
Outlook
FTP Client
WWW Server
192.168.254.254: 80
FTP Server
192.168.254.254: 21
Browser
MAIL Server
192.168.254.254: 25
Client
Eagle Server
192.168.254.254
Unique connection point : IP Address :Port number pair
Network Application
Programs that run
on different end
systems and
communicate over
a network.
Example:
Browser on client
machine
communicates
with a Server
applicati
on
transpor
t
network
data link
physical
applicati
on
transpor
t
network
data link
physical
applicati
on
transpor
t
network
data link
physical
Outline
In this lecture, we will look at some
Application Layer Protocols
 FTP (File Transfer Protocol)
Command line interface
 Telnet
Application Layer Protocol defines
 Types of messages exchanged,
eg, request & response messages
Syntax (Structure) of message
 Semantics of the fields, ie, meaning
of information in fields
 Rules for when and how processes send
& respond to messages
FTP: File Transfer Protocol
user
at host
FTP
FTP
user
client
interface
file transfer
local file
system
FTP
server
remote 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 listens on port 21
FTP: Control and Data connections
TCP control connection
port 21
 FTP client contacts FTP server at




port 21
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
Server opens a second TCP
data connection to transfer
another file.
FTP server maintains
“state”: current directory,
earlier authentication
FTP – File Transfer Protocol
user
interface
Application Layer
Application Layer
user
control connection
protocol
interpreter
file system
data
transfer
function
(FTP commands and
replies)
data connection
TCP
protocol
interpreter
data
transfer
function
TCP
Three Way Handshake
Client
Server
file system
FTP: Commands/Responses
Sample commands:
Sent as text over control channel
 USER <username >
 PASS <password
 LIST return list of file in
current directory
 RETR filename retrieves
(gets) file
 STOR filename stores
(puts) file onto remote host
Sample return codes
Status code and phrase
 331 Username OK,
password required
 125 data connection
already open;
transfer starting
 425 Can’t open data
connection
 452 Error writing
file
Telnet
 provides remote login service to users
 works between hosts that use different operating
systems
Telnet client
kernel
Telnet server
login shell
kernel
terminal
driver
TCP/IP
TCP/IP
TCP connection
user
pseudoterminal
driver
Example: Telnet Mail Server
 C:\>telnet eagle-server.example.com 25
Client
 220 localhost.localdomain ESMTP Sendmail 8.13.1/8.13.1; Sun, 28 Jan2007 20:41:0 3
+1000
Server
 HELO eagle-server.example.com
Client
 250 localhost.localdomain Hello [172.16.1.2], pleased to meet you

MAIL From: [email protected]
Server
Client
 250 2.1.0 [email protected]... Sender ok
Server
 RCPT To: [email protected]
Client
 250 2.1.5 [email protected]... Recipient ok

DATA
Client
 354 Please start mail input.
Server
 I'm trying to test this connection from Telnet. Let me know if you get this message.
 .
Client
 250 Mail queued for delivery.
Server
 QUIT
Client
 221 Closing connection. Good bye.Connection to host lost. C:\ >
Server
HTTP - Hypertext Transfer Protocol
HTTP: Hypertext Transfer
Protocol
 client/server model
 client: browser that
requests, receives,
“displays” Web objects
 server: Web server sends
objects in response to
requests
PC running
Explorer
Server
running
Apache Web
server
Mac running
Navigator
HTTP overview
Uses TCP:
 Client initiates and opens connection to WWW
server at port 80
 Server accepts TCP connection from client
 HTTP messages (application-layer protocol
messages) exchanged between browser (HTTP
client) and Web server (HTTP server)
 Connection closed
HTTP connections
Non-persistent 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
HTTP request message
 Two types of HTTP messages: request, response
 HTTP request message:
 ASCII (human-readable format)
request line
(GET, POST,
HEAD commands)
header
lines
Carriage return,
line feed
indicates end
of message
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)
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 data data data ...
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
Web caches (proxy server)
Goal: satisfy client request without involving origin
server
 user sets browser: Web
accesses via cache
 browser sends all HTTP
requests to cache
 object in cache: cache
returns object
 else cache requests
object from origin
server, then returns
object to client
client
client
origin
server
Proxy
server
origin
server
Related documents