0% found this document useful (0 votes)
14 views

Lecture 8

The document discusses two protocols for transferring files and email: 1. FTP allows users to transfer files between a client and remote server using separate control and data connections on ports 21 and 20. 2. SMTP is the standard protocol for sending email between servers over TCP port 25. Email messages are composed of headers and bodies in ASCII and routed from the sending to receiving server. 3. Additional protocols like POP and IMAP allow users to access their email stored on remote servers.

Uploaded by

Ciyene Lekaota
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Lecture 8

The document discusses two protocols for transferring files and email: 1. FTP allows users to transfer files between a client and remote server using separate control and data connections on ports 21 and 20. 2. SMTP is the standard protocol for sending email between servers over TCP port 25. Email messages are composed of headers and bodies in ASCII and routed from the sending to receiving server. 3. Additional protocols like POP and IMAP allow users to access their email stored on remote servers.

Uploaded by

Ciyene Lekaota
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

CS3441

File Transfer Protocol and Electronic


mail

CS3441 - Computer Communications and Networks I 1


FTP: the file transfer protocol
file transfer
FTP FTP FTP
user client server
interface
user
at host remote file
local file system
system

 transfer file to/from remote host


 client/server model
 client: side that initiates transfer (either to/from remote)
 server: remote host
 ftp: RFC 959
 ftp server: port 21

CS3441 - Computer Communications and Networks I 2


FTP: separate control, data connections
TCP control connection,
• FTP client contacts FTP server server port 21
at port 21, using TCP
• client authorized over control TCP data connection,
connection FTP server port 20 FTP
client server
• client browses remote
directory, sends commands  server opens another TCP
over control connection data connection to transfer
• when server receives file another file
transfer command, server  control connection: “out of
opens 2nd TCP data connection band”
(for file) to client  FTP server maintains “state”:
• after transferring one file, current directory, earlier
authentication
server closes data connection
CS3441 - Computer Communications and Networks I 3
FTP commands, responses
sample commands: sample return codes
• sent as ASCII text over • status code and phrase (as in
control channel HTTP)
• USER username • 331 Username OK,
• PASS password password required
• 125 data connection
• LIST return list of file in
already open;
current directory
transfer starting
• RETR filename retrieves • 425 Can’t open data
(gets) file connection
• STOR filename stores • 452 Error writing
(puts) file onto remote host file

CS3441 - Computer Communications and Networks I 4


Electronic mail outgoing
message queue
user mailbox
Three major components: user
agent
• user agents
• mail servers mail user
• simple mail transfer protocol: server agent
SMTP
SMTP mail user
server agent
User Agent
SMTP
• a.k.a. “mail reader”
• composing, editing, reading SMTP user
mail messages agent
mail
• e.g., Outlook, Thunderbird, server
iPhone mail client user
agent
• outgoing, incoming messages
stored on server user
agent

CS3441 - Computer Communications and Networks I 5


Electronic mail: mail servers
user
agent
mail servers:
mail
• mailbox contains incoming server
user
agent
messages for user
SMTP
• message queue of outgoing mail user
server agent
(to be sent) mail messages
SMTP
• SMTP protocol between
mail servers to send email SMTP user
agent
messages mail
server
– client: sending mail user
server agent

– “server”: receiving mail user


agent
server

CS3441 - Computer Communications and Networks I 6


Electronic Mail: SMTP [RFC 2821]
• uses TCP to reliably transfer email 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 (like HTTP, FTP)
– commands: ASCII text
– response: status code and phrase
• messages must be in 7-bit ASCI

CS3441 - Computer Communications and Networks I 7


Scenario: Alice sends message to Bob
1) Alice uses UA to compose 4) SMTP client sends Alice’s
message “to” message over the TCP
[email protected] connection
2) Alice’s UA sends message to 5) Bob’s mail server places the
her mail server; message message in Bob’s mailbox
placed in message queue
3) client side of SMTP opens 6) Bob invokes his user agent to
TCP connection with Bob’s read message
mail server

1 user mail user


mail agent
agent server server
2 3 6
4
5
Alice’s mail server Bob’s mail server
CS3441 - Computer Communications and Networks I 8
Sample SMTP interaction
S: 220 hamburger.edu
C: HELO crepes.fr
S: 250 Hello crepes.fr, pleased to meet you
C: MAIL FROM: <[email protected]>
S: 250 [email protected]... Sender ok
C: RCPT TO: <[email protected]>
S: 250 [email protected] ... Recipient ok
C: DATA
S: 354 Enter mail, end with "." on a line by itself
C: Do you like ketchup?
C: How about pickles?
C: .
S: 250 Message accepted for delivery
C: QUIT
S: 221 hamburger.edu closing connection

CS3441 - Computer Communications and Networks I 9


Try SMTP interaction for yourself:
• telnet servername 25
• see 220 reply from server
• enter HELO, MAIL FROM, RCPT TO, DATA, QUIT commands

above lets you send email without using email client (reader)

CS3441 - Computer Communications and Networks I 10


SMTP: final words
• SMTP uses persistent comparison with HTTP:
connections • HTTP: pull
• SMTP requires message • SMTP: push
(header & body) to be in
7-bit ASCII • both have ASCII
command/response
• SMTP server uses
interaction, status codes
CRLF.CRLF to
determine end of • HTTP: each object
message encapsulated in its own
response msg
• SMTP: multiple objects
sent in multipart msg
CS3441 - Computer Communications and Networks I 11
Mail message format

SMTP: protocol for


exchanging email msgs header
blank
RFC 822: standard for text line

message format:
• header lines, e.g., body
– To:
– From:
– Subject:
• Body: the “message”
– ASCII characters only

CS3441 - Computer Communications and Networks I 12


Mail access protocols
mail access
user SMTP SMTP user
protocol
agent agent
(e.g., POP,
IMAP)

sender’s mail receiver’s mail


server server

• SMTP: delivery/storage to receiver’s server


• mail access protocol: retrieval from server
– POP: Post Office Protocol [RFC 1939]: authorization, download
– IMAP: Internet Mail Access Protocol [RFC 1730]: more
features, including manipulation of stored msgs on server
– HTTP: gmail, Hotmail, Yahoo! Mail, etc.

CS3441 - Computer Communications and Networks I 13


POP3 protocol
S: +OK POP3 server ready
C: user bob
authorization phase S: +OK
C: pass hungry
• client commands: S: +OK user successfully logged on
– user: declare username
C: list
– pass: password S: 1 498
• server responses S: 2 912
– +OK S: .
– -ERR C: retr 1
S: <message 1 contents>
transaction phase, client: S: .
• list: list message numbers C: dele 1
• retr: retrieve message by C: retr 2
number S: <message 1 contents>
S: .
• dele: delete C: dele 2
• quit C: quit
S: +OK POP3 server signing off
CS3441 - Computer Communications and Networks I 14
POP3 (more) and IMAP
more about POP3 IMAP
• previous example uses • keeps all messages in one
POP3 “download and place: at server
delete” mode
• allows user to organize
– Bob cannot re-read e- messages in folders
mail if he changes
client • keeps user state across
• POP3 “download-and- sessions:
keep”: copies of messages – names of folders and
on different clients mappings between
• POP3 is stateless across message IDs and folder
sessions name

CS3441 - Computer Communications and Networks I 15

You might also like