Download presentation
Presentation is loading. Please wait.
Published byGwen Barrett Modified over 8 years ago
1
Internet and Intranet Protocols and Applications Lecture 6 Application Protocols: Telnet, FTP February 27, 2002 Joseph Conron Computer Science Department New York University jconron@cs.nyu.edu
2
Telnet Used for remote login Follows client/server model Uses TCP/IP Interactive application RFC 854
3
Remote Login Client application emulates a terminal –two devices keyboard display Server application passes data through to OS as if terminal were local tty (pseudo terminal )
4
Telnet: client/server
5
Telnet: Interactive Application User sends small messages frequently (key strokes) Server also sends small messages frequently (character echo) How to avoid wasteful TCP packets? –Nagel’s Algorithm
6
Digression: Nagle’s Algorithm When data arrives one byte at a time, send 1st byte Buffer remaining bytes until 1st byte is Acked Then send all buffered data Very good for apps like telnet, bad for some other apps (like X-Windows): why? Why does Nagle’s algorithm work? Question: if it’s good to delay sending request, can it help to delay Ack? When?
7
Telnet Network Virtual Terminal (NVT) Intermediate representation of a generic terminal. Provides a standard language for communication of terminal control functions. Defines a 7 bit code for keys and display codes. –Client converts actual key code to NVT code and sends to server. –Client converts NVT display codes to actual display codes and writes to display.
8
Telnet NVT Session
9
Control Functions TELNET includes support for a series of control functions commonly supported by servers. This provides a uniform mechanism for communication of (the supported) control functions.
10
Control Functions Interrupt Process (IP) –suspend/abort process. Abort Output (AO) –process can complete, but send no more output to user’s terminal. Are You There (AYT) –check to see if system is still running.
11
More Control Functions Erase Character (EC) –delete last character sent –typically used to edit keyboard input. Erase Line (EL) –delete all input in current line.
12
Command Structure All TELNET commands and data flow through the same TCP connection. Commands start with a special character called the Interpret as Command escape character (IAC). The IAC code is 255. If a 255 is sent as data - it must be followed by another 255.
13
Looking for Commands Each receiver must look at each byte that arrives and look for IAC. If IAC is found and the next byte is IAC - a single byte is presented to the application/terminal. If IAC is followed by any other code - the TELNET layer interprets this as a command.
14
Commands vs Data Because commands can be embedded in data stream, most implementations use FSM to process input stream(s). The ability to send commands at any time allows some interesting possiblities, like: – file transfer –emulating buffered terminals like 3270
15
Command Codes IP243 AO 244 AYT245 EC246 EL247 n WILL251 n WON’T252 n DO253 n DON’T254 n IAC255
16
NVT: Negotiating Options All NVTs support a minimal set of capabilities. But, some applications need more capabilities than the minimal set. How to do this? –The 2 endpoints negotiate a set of mutually acceptable options (character set, echo mode, etc). –The protocol for requesting optional features is well defined in RFC 854. –The set of options is not part of the TELNET protocol. new terminal features can be incorporated without changing TELNET protocol. These are defined in separate RFCs
17
NVT: Options Variety of options can be negotiated at ANY time: –terminal type (e.g. Vt100) –window size –echo (or not) –Command sequence: IAC operation is one of: –WILL, WONT, DO, DONT Some options require sub-negotiation (we won’t go into this)
18
Option examples Line mode vs. character mode echo modes character set (EBCDIC vs. ASCII)
19
Option Negotiation Client wants to disable echo, so sends – If server agrees, server responds – Server can choose option before client asks – And client can say NO –
20
File Transfer Protocol (FTP) TCP/IP standard is File Transfer Protocol (FTP) General purpose protocol Operating system and hardware independent Transfers arbitrary files Accommodates file ownership and access restrictions Predates TCP/IP; adapted to TCP/IP later
21
File Transfer Protocol (FTP) client/server model –client: side that initiates transfer (either to/from remote) –server: remote host ftp: RFC 959 ftp server: port 21
22
FTP: Issues Allow transfer of arbitrary files Accommodate different file types Convert between heterogeneous systems –Data types –Word lengths –Rules for file names Provide some security (user login) Permit Interactive or Batch Operation
23
The FTP Model ------------- |/---------\| || User || -------- ||Interface| | User | |\----^----/| -------- ---------- | | | |/------\| FTP Commands |/----V----\| ||Server| | User || || PI || FTP Replies || PI || |\--^---/| |\----^----/| | | | | | | -------- |/--V---\| Data |/----V----\| -------- | File | |Server| | User | | File | |System| || DTP || Connection || DTP || |System| -------- |\------/| |\---------/| -------- ---------- ------------- Server-FTP USER-FTP Figure from RFC 959
24
FTP: separate control, data connections ftp client contacts ftp server at port 21 two parallel TCP connections opened: –control: exchange commands, responses between client, server. “out of band control” –data: file data to/from server ftp server maintains “state” FTP client FTP server TCP control connection port 21 TCP data connection port 20
25
FTP: Using separate data connections Separates commands from data Client can send commands during data transfer Closed connection indicates end of file Control connection persists, data connections come and go
26
FTP commands Sent as ASCII 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
27
FTP return codes Status code and phrase (as in smtp, http) returned in ASCII over control connection –331 Username OK, password required –125 data connection already open; transfer starting –425 Can’t open data connection –452 Error writing file
28
LOCAL COMMANDS BY USER ACTION INVOLVED ftp (host) multics Connect to host S, port L, establishing control connections.. username Doe USER Doe ----> <---- 331 User name ok, need password. password mumble PASS mumble ---->. retrieve (local type) ASCII (local pathname) test 1 User-FTP opens local file in ASCII. (for. pathname) test.pl1 RETR test.pl1 ----> <---- 150 File status okay; about to open data connection. Server makes data connection to port U. <---- 226 Closing data connection, file transfer successful. type Image TYPE I ----> store (local type) image (local pathname) file dump User-FTP opens local file in Image. for.pathname) >udd>cn>fd STOR >udd>cn>fd ----> terminate QUIT ----> Server closes all connections. Example Protocol Interaction
29
TFTP Trivial File Transfer Protocol (TFTP) - much simpler than FTP –Based on UDP –File transfer only; no directory listing –No authorization Requires less code than FTP Often used for bootstrap; e.g., ROM-based diskless system
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.