100 likes | 307 Views
Lecture 4. SMTP, TELNET, and FTP Objective: to know the underlying principles of Simple Mail Transfer Protocol (SMTP) Telnet (a remote log in) protocol File Transfer Protocol. Simple Mail Transfer Protocol (SMTP) SMTP defines a mechanism for electronic mail based on TCP/IP. It supports
E N D
Lecture 4. SMTP, TELNET, and FTPObjective: to know the underlying principles of • Simple Mail Transfer Protocol (SMTP) • Telnet (a remote log in) protocol • File Transfer Protocol Simple Mail Transfer Protocol (SMTP) • SMTP defines a mechanism for electronic mail based on TCP/IP. It supports • Sending a single message to one or more recipients identified by email address. • Sending messages that include text, voice, video, ore graphics. Sending message outside the Internet. • SMTP mechanism • A human user uses a user agent (UA) to prepare the message contains header and body • Creating the envelope containing the sender’s address, receiver’s address, and other information
User A User B Interface Interface UA UA spool mailboxes spool mailboxes database Alias exp. Alias exp. database MTAClient MTAServer MTAClient MTAServer • The Message Transfer Agent (MTA) transfers the mail across the Internet, from MTA client to MTA server. • The user agent periodically checks the mailbox. TCP/IP/Data Link
Email address • local part@domain nameThe local part define the name of a mailbox, a file storing all incoming mail for a user, can be retrieved by the UA. • The domain name is the domain name of the MTA server. • Delay: stored in a spool on either side, intermediate delay. • Aliases: one-to-many, many-to-one • SMTP uses commands and responses to transfer messages between an MTA client and an MTA server
Commands by MTA client HELLO:hfan.wlu.caMAIL FROM: hfan@wlu.caRCTP TO: hfan@wlu.caDATA followed by the actual dataQUIT, RESET, HELP, VRFY, NOOP, SEND FROM, etc. • Responses by MTA server A three-digit code: 214 Help message, 220 Service ready, 221 Close channel250 OK354 Start mail input, 421 Service is not available450 Mail box is not available, etc. • Mail transfer phases:Steps: 1. connection establishment, MTA Client (MC) makes a TCP connection to port 25MTA sever (MS) responses 220 (service ready), MC: send command HELLO:hfan.wlu.ca, MS responses 250 (OK).
Step 2. mail transfer: after connection between MTA client and MTA server. An eight step message transfer is connected. MC: MAIL FROM:hfan@wlu.caMS: 250MC: RCPT TO:master@wlu.caMS: 250MC: DATAMS: 354MC: From: To: Date: Subject: space line ….. Dear: the contents of the email . MS: 250 Step 3. connection termination MC: QUITMS: 221 • Multipurpose Internet Mail Extension (MIME) is an extension of SMTP that allow the transfer of multimedia message.
Mail access protocols • POP (Post Office Protocol) The client open opens a connection with serveron TCP port 110. It then sends its user name and password to access the mailbox. POP client (PC) communicates with POP server (PS)UC: user namePS: OKUC: passwordPS: OKUC: listPS: the number of emails and their sizesPC: retrieve 1PS: email 1…………..PC: retrieve NPS: email N • IMAP1. Client can check the email header2. Search the email for a special string3. Partially download an email4. Can create, delete or rename mailbox on server side5. Can create a hierarchy of mailbox.
Applicationprograms Terminal Telnet client Telnet server TCPIPData linkPhysical TCPIPData linkPhysical Terminaldriver Terminaldriver OS OS Local character set Remote character set Internet NVT character set TELNET • Define a mechanism for users to log on to a remote machine using TCP/IP. • TELNET uses one TCP connection. Server uses port 23 and client uses an ephemeral port. The same connection is used for both control commands and data. This is accomplished by embedding the control characters in a data stream. • A terminal driver interprets the keystrokes on the local terminal or terminal emulator.
Control Characters • Telnet use the Network Virtual Terminal (NVT) system to encode characters on the local system. • On the server machine, NVT decodes the characters to a form acceptable to the remote machine. • NVT uses an 8-bit character set in which the highest order bit is set to be one. EOF = 236 = 111011100 end of fileEOR = 239 end of recordIAC = 255 = Interpreted as Control, etc. • A set of characters for remote control, control characters are embedded in the data stream and preceded by the interpreter IAC. • OptionsBinary, echo, suppress go-head, status, timing mark, terminal type, terminal speed, line mode
File Transfer Protocol (FTP) • FTP defines a mechanism for copying a file from one host to another using TCP/IP • FTP requires two connections for data transfer • A control connection on port 21 (server side) • A data connection on port 20 (server side) • Control 1. The server issues a passive open 2. The client uses a ephemeral port and issues an active open • Data connection: 1. The client issues a passive open using ephemeral port. 2. Client sends this port number to the server using PORT command, 3. the server receives the port number and issues an active open using the port 20. • Communication over control connection uses NVT ASCII. File type: ASCII, Binary. Trans. Mode: stream, block, and compressed mode.
Prior to the actual transfer of files, the file type, data structure, and transmission mode are defined by the client through control connection. • There are six classes of commands sent by the client to establish communication with the sever: 1. Access commands: USER, PASS, ACCT, QUIT, etc 2. File management commands:CWD ( directory name, DELE (file name), RNTO (rename), etc. 3. Data formatting commands, 4. port defining commands, 5. file transfer commands, 6. Mis. Commands. • Responses are sent from the server to the client during connection establishment. Three digits code. • There are three types of file transfer • A file is copied from server to client • A file is copied from client to sever • A list of directories or filenames is sent from server to client.