FTP (File Transfer Protocol) & Telnet Application Layer.

18
FTP (File Transfer Protocol) & Telnet Application Layer

Transcript of FTP (File Transfer Protocol) & Telnet Application Layer.

Page 1: FTP (File Transfer Protocol) & Telnet Application Layer.

FTP (File Transfer Protocol) &Telnet

Application Layer

Page 2: FTP (File Transfer Protocol) & Telnet Application Layer.

Transport Layer and Port Numbers

Eagle Server192.168.254.254

WWW Server

MAIL Server

Browser

FTP Client

Email clientOutlook

Client

Unique connection point : IP Address :Port number pair

192.168.254.254: 25

192.168.254.254: 80

192.168.254.254: 21FTP Server

Page 3: FTP (File Transfer Protocol) & Telnet Application Layer.

Network Application

Programs that run on different end systems and communicate over a network.

Example:Browser on client machine communicates with a Server

application

transport

networkdata link

physical

application

transport

networkdata link

physical

application

transport

networkdata link

physical

Page 4: FTP (File Transfer Protocol) & Telnet Application Layer.

Outline

In this lecture, we will look at some Application Layer Protocols

FTP (File Transfer Protocol)Command line interface

Telnet

Page 5: FTP (File Transfer Protocol) & Telnet Application Layer.

Application Layer Protocol definesTypes of messages exchanged,

eg, request & response messagesSyntax (Structure) of message Semantics of the fields, ie, meaning of information in fields

Rules for when and how processes send & respond to messages

Page 6: FTP (File Transfer Protocol) & Telnet Application Layer.

FTP: File Transfer Protocol

transfer file to/from remote hostclient/server model

Client: side that initiates transfer (either to/from remote)

Server: remote hostFTP server listens on port 21

file transfer FTPserver

FTPuser

interface

FTPclient

local filesystem

remote filesystem

user at host

Page 7: FTP (File Transfer Protocol) & Telnet Application Layer.

FTP: Control and Data connectionsFTP client contacts FTP server

at port 21Client obtains authorization

over control connectionClient 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.

FTPclient

FTPserver

TCP control connection

port 21

TCP data connectionport 20

Server opens a second TCP data connection to transfer another file.

FTP server maintains “state”: current directory, earlier authentication

Page 8: FTP (File Transfer Protocol) & Telnet Application Layer.

FTP – File Transfer Protocol

user

userinterface

userinterface

protocolinterpreter

protocolinterpreter

datatransferfunction

datatransferfunction

file system

protocolinterpreter

protocolinterpreter

datatransferfunction

datatransferfunction

file system

Client Server

data connection

control connection

(FTP commands and replies)

TCPTCP TCPTCP

Three Way Handshake

Application Layer

Application Layer

Page 9: FTP (File Transfer Protocol) & Telnet Application Layer.

FTP: Commands/ResponsesSample commands:Sent as text over control

channelUSER <username >PASS <passwordLIST return list of file in

current directoryRETR filename retrieves

(gets) fileSTOR filename stores

(puts) file onto remote host

Sample return codesStatus code and phrase331 Username OK, password required

125 data connection already open; transfer starting

425 Can’t open data connection

452 Error writing file

Page 10: FTP (File Transfer Protocol) & Telnet Application Layer.

Telnetprovides remote login service to usersworks between hosts that use different

operating systems

Telnet clientTelnet clientTelnet serverTelnet server

terminaldriver

terminaldriver TCP/IPTCP/IP pseudo-

terminaldriver

pseudo-terminaldriver

TCP/IPTCP/IP

login shelllogin shell

user

kernel kernel

TCP connection

Page 11: FTP (File Transfer Protocol) & Telnet Application Layer.

Example: Telnet Mail Server C:\>telnet eagle-server.example.com 25 220 localhost.localdomain ESMTP Sendmail 8.13.1/8.13.1; Sun, 28 Jan2007 20:41:0

3 +1000  HELO eagle-server.example.com 250 localhost.localdomain Hello [172.16.1.2], pleased to meet you  MAIL From: [email protected] 250 2.1.0 [email protected]... Sender ok  RCPT To: [email protected] 250 2.1.5 [email protected]... Recipient ok  DATA 354 Please start mail input. I'm trying to test this connection from Telnet. Let me know if you get this message. . 250 Mail queued for delivery. QUIT 221 Closing connection. Good bye.Connection to host lost. C:\ >

Client

Server

Client

Client

Client

Server

Server

Server

Server

Client

Client

ServerClient

Page 12: FTP (File Transfer Protocol) & Telnet Application Layer.

HTTP - Hypertext Transfer Protocol

HTTP: Hypertext Transfer Protocol

client/server modelclient: browser that

requests, receives, “displays” Web objects

server: Web server sends objects in response to requests

PC runningExplorer

Server running

Apache Webserver

Mac runningNavigator

HTTP request

HTTP request

HTTP response

HTTP response

Page 13: FTP (File Transfer Protocol) & Telnet Application Layer.

Uses TCP:Client initiates and opens connection to

WWW server at port 80Server accepts TCP connection from

clientHTTP messages (application-layer

protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server)

Connection closed

HTTP overview

Page 14: FTP (File Transfer Protocol) & Telnet Application Layer.

HTTP connections

Non-persistent HTTPAt most one object is sent over a TCP connection.

HTTP/1.0 uses nonpersistent HTTP

Persistent HTTPMultiple objects can

be sent over single TCP connection between client and server.

HTTP/1.1 uses persistent connections in default mode

Page 15: FTP (File Transfer Protocol) & Telnet Application Layer.

HTTP request messageTwo types of HTTP messages: request, response

HTTP request message:ASCII (human-readable format)

GET /somedir/page.html HTTP/1.1Host: www.someschool.edu User-agent: Mozilla/4.0Connection: 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

Page 16: FTP (File Transfer Protocol) & Telnet Application Layer.

HTTP response message

HTTP/1.1 200 OK Connection closeDate: 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 codestatus phrase)

header lines

data, e.g., requestedHTML file

Page 17: FTP (File Transfer Protocol) & Telnet Application Layer.

HTTP response status codes200 OK

request succeeded, requested object later in this message

301 Moved Permanentlyrequested object moved, new location

specified later in this message (Location:)400 Bad Request

request message not understood by server404 Not Found

requested document not found on this server505 HTTP Version Not Supported

Page 18: FTP (File Transfer Protocol) & Telnet Application Layer.

Web caches (proxy server)

user sets browser: Web accesses via cache

browser sends all HTTP requests to cacheobject in cache: cache

returns object else cache requests

object from origin server, then returns object to client

Goal: satisfy client request without involving origin server

client

Proxyserver

client

HTTP request

HTTP request

HTTP response

HTTP response

HTTP request

HTTP response

origin server

origin server