ECE5650 - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

ECE5650

Description:

HTTP request msg format and method types: GET, POST, HEAD, PUT, DELATE ... Subject: Picture of yummy crepe. MIME-Version: 1.0. Content-Transfer-Encoding: base64 ... – PowerPoint PPT presentation

Number of Views:31
Avg rating:3.0/5.0
Slides: 24
Provided by: JimKurosea311
Category:
Tags: ece5650

less

Transcript and Presenter's Notes

Title: ECE5650


1
ECE5650
  • FTP, Email, DNS, and P2P

2
Recap HTTP and Web
  • HTTP request msg format and method types
  • GET, POST, HEAD, PUT, DELATE
  • HTTP response msg format and status codes
  • Cookies and their usage
  • Persistent vs Non-Persistent cookies
  • Web cache or proxy server
  • Conditional GET (If-modified-since) in HTTP
    header

3
Examples ofInternet Services
  • 2.1 Principles of network applications
  • 2.2 Web and HTTP
  • 2.3 FTP
  • 2.4 Electronic Mail
  • SMTP, POP3, IMAP
  • 2.5 DNS
  • 2.6 P2P file sharing
  • 2.7 Socket programming with TCP
  • 2.8 Socket programming with UDP
  • 2.9 Building a Web server

4
FTP the file transfer protocol
file transfer
user at host
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 RFC 959
  • ftp server port 21 for control, port 20 for data

5
SFTP secure file transfer protocol
file transfer over SSH
user at host
remote file system
  • All communication (login, control and data are
    secured)
  • transfer file to/from remote host
  • same as FTP client/server model
  • network protocol designed by the IETF to provide
    secure file transfer and manipulation facilities
    over the secure shell (SSH) protocol.

6
FTP separate control, data connections
  • FTP client contacts FTP server at port 21,
    specifying TCP as transport protocol
  • Client obtains authorization over control
    connection
  • Client browses remote directory by sending
    commands over the persistent control connection.
  • When server receives a command for a file
    transfer or directory listing, the server opens a
    TCP data connection to client
  • After transferring one file, server closes
    connection.
  • Server opens a second TCP data connection to
    transfer another file.
  • Control connection out of band
  • HTTP sends control info in-band
  • FTP server maintains state current directory,
    earlier authentication

7
FTP commands, responses
  • Sample commands
  • sent as ASCII text over control channel
  • USER username
  • PASS password
  • LIST return list of file in current directory
  • RETR (Get) filename retrieves (gets) file
  • STOR (Put) filename stores (puts) file onto
    remote host
  • Sample return codes
  • status code and phrase (as in HTTP)
  • 331 Username OK, password required
  • 125 data connection already open transfer
    starting
  • 425 Cant open data connection
  • 452 Error writing file

8
All FTP commands (RFC 959)
  • Access control commands
  • USER, PASS, ACT, CWD, CDUP, SMNT, REIN, QUIT.
  • Transfer parameter commands
  • PORT, PASV, TYPE STRU, MODE.
  • Service commands
  • RETR, STOR, STOU, APPE, ALLO, REST, RNFR, RNTO,
    ABOR, DELE, RMD, MRD, PWD, LIST, NLST, SITE,
    SYST, STAT, HELP, NOOP.
  • www.faqs.org/rfcs/rfc959.html

9
FTP Summary
  • FTP/SFTP is used to transfer files between hosts
  • FTP is an out-of-band protocol control is sent
    over server port 21 while data is sent over
    server port 20.
  • Control connection is persistent and the FTP
    server must maintain the state of the user.
  • Data connection is non-persistent and initiated
    by FTP server.

10
Electronic Mail
  • Three major components
  • user agents
  • mail servers
  • simple mail transfer protocol SMTP
  • User Agent
  • a.k.a. mail reader
  • composing, editing, reading mail messages
  • e.g., Eudora, Outlook, elm, Netscape Messenger
  • outgoing, incoming messages stored on server

11
Electronic Mail mail servers
  • Mail Servers
  • mailbox contains incoming messages for user
  • message queue of outgoing (to be sent) mail
    messages
  • SMTP protocol between mail servers to send email
    messages
  • client sending mail server
  • server receiving mail server

12
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
  • commands ASCII text
  • response status code and phrase
  • messages must be in 7-bit ASCII

13
Scenario Alice sends message to Bob
  • 4) SMTP client sends Alices message over the TCP
    connection
  • 5) Bobs mail server places the message in Bobs
    mailbox
  • 6) Bob invokes his user agent to read message
  • 1) Alice uses UA to compose message and to
    bob_at_wayne.edu
  • 2) Alices UA sends message to her mail server
    message placed in message queue
  • 3) Client side of SMTP opens TCP connection with
    Bobs mail server

1
2
6
3
4
5
14
Sample SMTP interaction
C telnet smtp.wayne.edu 25 S 220
mirapointmr3.wayne.edu C HELO alice
S 250 Hello alice, pleased to meet you C
MAIL FROM ltalice_at_crepes.frgt S 250
alice_at_crepes.fr... Sender ok C RCPT TO
ltbob_at_wayne.edugt S 250 bob_at_wayne.edu ...
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 wayne.edu
closing connection
15
Try SMTP interaction for yourself
  • telnet ece.eng.wayne.edu 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)

16
SMTP Mail message format
  • SMTP protocol for exchanging email msgs
  • RFC 822 standard for text message format
  • header lines, e.g.,
  • To
  • From
  • Subject
  • different from SMTP
  • commands. SMTP msg goes
  • into the DATA command
  • body
  • the message, 7-bit ASCII characters only

header
blank line
body
17
Message format multimedia extensions
  • MIME multimedia mail extension, RFC 2045, 2056
  • additional lines in msg header declare MIME
    content type

MIME version
method used to encode data, quoted-printable is
another method
multimedia data type, subtype, parameter
declaration
encoded data where each line is 78 7-bit ASCII
characters including CRLF
18
Base64 encoding scheme (RFC 2045)
  • Encoding (not encrypting) method
  • input 8 bit ASCII data
  • output one of the 64 values listed in the Base64
    encoding table and the character
  • Process
  • group the input data in chunks of 3-bytes or
    24-bits each
  • break each 24-bit chunk into 4 values that are
    6-bits each
  • use the Base64 encoding table to find the
    character of each value
  • if any chunk is less than 3 bytes then pad it
    with 0s and use the for any of these 6 0s. A
    6-bit value with all 0s and at least 1 non-padded
    0 will be an A
  • Smallest base64 encoded output is 4 characters.

Example input is AB A ASCII hex0x41 B ASCII
hex0x42 16-bits 8 padded 0s 0100 0001 0100
0010 0000 0000 4 values that are 6-bits
each 010000-010100-001000-000000 16-20-8-6
padded 0s Base64 output is QUI
19
Mail access protocols
SMTP
access protocol
receivers mail server
  • SMTP delivery/storage to receivers server
  • Mail access protocol retrieval from server
  • POP3 Post Office Protocol version 3 RFC 1939
    uses port 110
  • authorization (agent lt--gtserver) and download
  • IMAP Internet Mail Access Protocol RFC 1730
  • more features (more complex)
  • manipulation of stored msgs on server
  • HTTP Hotmail , Yahoo! Mail, etc.

20
POP3 protocol
C telnet mail.wayne.edu 110 S OK POP3 server
ready C user bob S OK C pass hungry S
OK user successfully logged on
  • authorization phase
  • client commands
  • user declare username
  • pass password
  • server responses
  • OK (Server accepted prior command)
  • -ERR (server rejected prior command)
  • transaction phase, client
  • list list message numbers
  • retr retrieve message by number
  • dele delete
  • quit
  • UIDL unique-ID listing list unique message ID
    for all of the messages present in the users
    mailbox. Useful for download-and-keep by keeping
    a file that lists the messages retrieved in
    earlier sessions, the client can use the UIDL
    command to determine which messages on the server
    have already been seen.
  • Received in the msg indicates the SMTP servers
    that forwarded the msg

C list S 1 498 S 2 912
S . C retr 1 S Return-Path
ltfromuser_at_..gt S Received from b1 by d1
... S more data.. S . C dele 1
C retr 2 S ltmessage 1 contentsgt
S . C dele 2 C quit S OK
POP3 server signing off
21
POP3 (more) and IMAP
  • More about POP3
  • Previous example uses download-and-delete mode.
  • User cannot re-read the deleted e-mail.
  • Download-and-keep copies of messages on
    different clients
  • POP3 is stateless across sessions
  • IMAP
  • Keep all messages in one place the server
  • Allows user to organize messages in folders
  • IMAP keeps user state across sessions
  • names of folders and mappings between message IDs
    and folder name

22
Email Summary
  • Comparison with HTTP
  • HTTP pull data from web server
  • SMTP push data to mail server
  • both have command/response interaction, status
    codes
  • HTTP each object encapsulated in its own
    response msg
  • SMTP multiple objects sent in one multipart msg
  • SMPT msg must be in 7-bit ASCII while HTTP has no
    restriction
  • SMTP and POP3 uses persistent connections
  • SMTP requires message (header body) to be in
    7-bit ASCII
  • SMTP server uses CRLF.CRLF to determine end of
    message
  • download-and-delete vs download-and-keep in POP3
  • All data communications are insecure by default

23
Examples ofInternet Services
  • 2.1 Principles of network applications
  • 2.2 Web and HTTP
  • 2.3 FTP
  • 2.4 Electronic Mail
  • SMTP, POP3, IMAP
  • 2.5 DNS
  • 2.6 P2P file sharing
  • 2.7 Socket programming with TCP
  • 2.8 Socket programming with UDP
  • 2.9 Building a Web server
Write a Comment
User Comments (0)
About PowerShow.com