CSS432 Applications Textbook Ch 9.1 - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

CSS432 Applications Textbook Ch 9.1

Description:

... . // drwxr-xr-x 1 css432 Tripod 0 Sep 15 21:22 cgi-bin // -rw-r--r-- 1 css432 Tripod 26169 Sep 16 18:28 ttcp.c // -rw-r--r-- 1 css432 Tripod ... – PowerPoint PPT presentation

Number of Views:55
Avg rating:3.0/5.0
Slides: 24
Provided by: klp7
Category:

less

Transcript and Presenter's Notes

Title: CSS432 Applications Textbook Ch 9.1


1
CSS432 ApplicationsTextbook Ch 9.1
Instructor Joe McCarthy(based on Prof. Fukudas
slides)
2
Applications
  • Client Server Paradigm
  • Client initiates contact with server
  • Server provides client with a response
  • Applications use their corresponding protocols
  • Defined in RFC by Internet Engineering Task Force
  • Implemented on top of TCP or UDP
  • Other documents define formats
  • E.g., MIME, HTML

Client
Server
SMTP, HTTP, FTP
SMTP, HTTP, FTP
socket
socket
Applications Protocol RFC Port
Name service DNS 1035 53
Email SMTP IMAP 821 3501 25 143
Web HTTP 2616 80
File transfer FTP 959 21
Remote terminal access telnet 854 23
Internet
3
Electronic Mail (SMTP, MIME, IMAP)
Email
  • user agents (client)
  • a.k.a. mail reader
  • composing, editing, reading mail messages
  • e.g., Eudora, Outlook, elm, Thunderbird
  • mail servers (server)
  • outgoing, incoming messages stored on server

SMTP
IMAP
4
SMTP
Email
  • Simple Mail Transfer Protocol
  • TCP port 25 Persistent connection
  • Email sending protocol
  • From user agent to his/her local mail server
  • From a local to an intermediate/destination mail
    server (direct transfer)
  • From an intermediate server to a destination
    server (relay)
  • Three phases of transfer
  • Handshaking HELO (ELHO when authentication
    required)
  • Transfer of messages MAIL FROM, RCPT TO, and
    DATA
  • Closure QUIT
  • Command/response interaction
  • Commands ASCII text
  • Response status code and phrase

5
SMTP Example
Email
mfukuda_at_uw1-320-20 telnet smtp.washington.edu
25 Trying 140.142.33.9 Connected to
smpt.washington.edu (140.142.33.9). Escape
character is . 220 smtp.washington.edu ESMTP
Sendmail 8.12.11UW04.02/8.12.11UW04.02 Sat,
21 Feb 2004 200056 -0800 HELO mfukuda 250
smtp.washington.edu Hello UW1-320-20.bothell.washi
ngton.edu 216.186.75.195 , pleased to meet
you MAIL FROMmfukuda_at_u.washington.edu 250 2.1.0
ltmfukuda_at_u.washington.edugt... Sender ok RCPT
TOMunehiroFukuda_at_yahoo.net 250 2.1.5
MunehiroFukuda_at_yahoo.net... Recipient ok DATA 354
Enter mail, end with . on a line by itself Blah
blah blah etc. etc. etc. . 250 2.0.0
i1M40uc3013699 Message accepted for
delivery QUIT 221 2.0.0 smtp.washington.edu
closing connection Connection closed by foreign
host. mfukuda_at_uw1-320-20 _
Note now requires authentication
6
RFC 822 Message Format
Email
  • Header
  • A series of lines, each terminated by ltCRLFgt
  • Body
  • ASCII characters only.
  • Then, what about multimedia information?

7
MIME
Email
  • MIME multimedia mail extension, RFC 2045, 2056
  • Additional lines in msg header declare MIME
    content type

MIME-Version 1.0 Content-Type multipart/mixed
boundary-------417CA6E2DE4ABCAFBC5 From
mfukuda_at_u.washington.edu To css432a_au04_at_u.washin
gton.edu Subject promised material Date Mon, 01
Apr 2004 123456 -0800 -------417CA6E2DE4ABCAFBC
5 Content-Type text/plain charsetus-ascii Conte
nt-Transfer-Encoding 7bit Dear CSS432
students, Here is the jpeg image and draft report
I promised. -- Fukuda -------417CA6E2DE4ABCAFBC5
Content-Type image/jpeg Content-Transfer-Encoding
base64 Unreadable encoding of a jpeg
figure -------417CA6E2DE4ABCAFBC5 Content-Type
application/postscript namedraft.ps Content-Tr
ansfer-Encoding 7bit Readable encoding of a
postscript document
Carry more than one data type
Type of the data
How the data is encoded
Definitions for content types
3 bytes 3 8 bits 24 bits ? 4 6-bit
chars, each mapped onto one of 26 64 ASCII
chars (AZ,az,09,,/)
8
Base64
A quote from Thomas Hobbes' Leviathan Man is
distinguished, not only by his reason, but by
this singular passion from other animals, which
is a lust of the mind, that by a perseverance of
delight in the continued and indefatigable
generation of knowledge, exceeds the short
vehemence of any carnal pleasure. represented as
a byte sequence of 8-bit-padded ASCII characters
is encoded in MIME's Base64 scheme as
follows TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5
IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIH
Bhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBh
IGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcm
FuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBp
bmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLC
BleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNh
cm5hbCBwbGVhc3VyZS4
http//en.wikipedia.org/wiki/Base64
9
MIME headers (RFC 822)
Received via tmail-2007b.22 (invoked by user
joemcc) for joemcc Tue, 22 May 2012 150348
-0700 (PDT) Received from mxout13.cac.washington
.edu (mxout13.cac.washington.edu
140.142.32.202) by cg81.u.washington.edu
(8.14.4UW11.03/8.14.4UW12.03) with ESMTP id
q4MM3YvT005956 for ltjoemcc_at_cg81.u.washington.edugt
Tue, 22 May 2012 150334 -0700 Received from
mailman1.u.washington.edu (mailman1.u.washington.e
du 140.142.17.220) by mxout13.cac.washington.edu
(8.14.4UW11.03/8.14.4UW12.03) with ESMTP id
q4MM3PGq019938 (versionTLSv1/SSLv3
cipherDHE-RSA-AES256-SHA bits256 verifyNO)
Tue, 22 May 2012 150325 -0700 Received from
mailman1.u.washington.edu (localhost 127.0.0.1)
by mailman1.u.washington.edu (8.14.4UW11.03/8.14.
4UW11.03) with ESMTP id q4MM3PkL000522 Tue, 22
May 2012 150325 -0700 Received from
mx2.cac.washington.edu (mx2.cac.washington.edu
140.142.33.18) by mailman1.u.washington.edu
(8.14.4UW11.03/8.14.4UW11.03) with ESMTP id
q4MM3OcS000490 Tue, 22 May 2012 150324
-0700 Received from mxout12.cac.washington.edu
(mxout12.cac.washington.edu 140.142.33.31) by
mx2.cac.washington.edu (8.14.4UW11.03/8.14.4UW12
.05) with ESMTP id q4MM37FI005160
(versionTLSv1/SSLv3 cipherDHE-RSA-AES256-SHA
bits256 verifyOK) Tue, 22 May 2012 150307
-0700 Received from smtp.washington.edu
(smtp.washington.edu 140.142.32.205 (may be
forged)) by mxout12.cac.washington.edu
(8.14.4UW11.03/8.14.4UW12.03) with ESMTP id
q4MM24HX002038 (versionTLSv1/SSLv3
cipherDHE-RSA-AES256-SHA bits256 verifyOK)
Tue, 22 May 2012 150204 -0700 X-Auth-Received
from d-69-91-211-215.dhcp4.washington.edu
(D-69-91-211-215.dhcp4.washington.edu
69.91.211.215) (authenticated
authidjoemcc_at_uw.edu) by smtp.washington.edu
(8.14.4UW11.03/8.14.4UW12.03) with ESMTP id
q4MM22j8014843 (versionTLSv1/SSLv3
cipherDHE-RSA-AES256-SHA bits256 verifyNOT)
Tue, 22 May 2012 150203 -0700
10
Message-ID lt4FBC0CCF.7050006_at_uw.edugt Date
Tue, 22 May 2012 150151 -0700 From joe
McCarthy ltjoemcc_at_uw.edugt User-Agent Mozilla/5.0
(Macintosh Intel Mac OS X 10.6 rv12.0)
Gecko/20120428 Thunderbird/12.0.1 MIME-Version
1.0 To css432a_sp12_at_uw.edu, css490b_sp12_at_uw.edu
Content-Type text/plain charsetISO-8859-1
formatflowed Content-Transfer-Encoding
7bit X-PMX-Version 6.0.0.2142326,
Antispam-Engine 2.7.2.2107409, Antispam-Data
2012.5.22.215414 X-PMX-Server mxout13.cac.washin
gton.edu X-Uwash-Spam GaugeIIIIIIII,
Probability8, Report' HTML_00_01 0.05,
HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0,
BODY_SIZE_1000_LESS 0, BODY_SIZE_2000_LESS 0,
BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0,
BODY_SIZE_700_799 0, DATE_TZ_NA 0, FROM_EDU_TLD
0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CTE
0, __CT_TEXT_PLAIN 0, __HAS_LIST_HEADER 0,
__HAS_LIST_HELP 0, __HAS_LIST_SUBSCRIBE 0,
__HAS_LIST_UNSUBSCRIBE 0, __HAS_MSGID 0,
__MIME_TEXT_ONLY 0, __MIME_VERSION 0,
__MOZILLA_MSGID 0, __PHISH_SPEAR_STRUCTURE_1 0,
__SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME
0, __URI_NO_MAILTO 0, __URI_NO_WWW 0, __URI_NS ,
__USER_AGENT 0' Cc Subject Css432a_sp12
TuTh office hours 745-815pm UW1-221 X-BeenThere
css432a_sp12_at_u.washington.edu X-Mailman-Version
2.1.5 Precedence list List-Id Class
Discussion List ltcss432a_sp12.u.washington.edugt Li
st-Unsubscribe lthttp//mailman1.u.washington.edu
/mailman/listinfo/css432a_sp12gt,
ltmailtocss432a_sp12-request_at_mailman1.u.washington
.edu?subjectunsubscribegt List-Archive
lthttps//mailman1.u.washington.edu/mailman/privat
e/css432a_sp12gt List-Post ltmailtocss432a_sp12_at_u
.washington.edugt List-Help ltmailtocss432a_sp12-
request_at_mailman1.u.washington.edu?subjecthelpgt Li
st-Subscribe lthttp//mailman1.u.washington.edu/m
ailman/listinfo/css432a_sp12gt, ltmailtocss432a_sp1
2-request_at_mailman1.u.washington.edu?subjectsubscr
ibegt Sender css432a_sp12-bounces_at_mailman1.u.wash
ington.edu Errors-To css432a_sp12-bounces_at_mailma
n1.u.washington.edu
11
Mail Reader - IMAP
Email
TCP to 143
Connection established
Server greeting
Server OK
Server PREAUTH
Server BYE
Not authenticated
Client LOGIN or AUTHENTICATE
Client LOGOUT
  • Flags
  • Seen
  • Answered
  • Deleted
  • Recent

Authenticated
Client CLOSE
Client LOGOUT
Client SELECT or EXAMINE
Selected
Client FETCH, STORE, DELETE, EXPUNGE
Client LOGOUT
Logout
Both sides close the connection
12
File Transfer Protocol (FTP)
FTP
  • Transfer file to/from remote host
  • Client/server model
  • Client initiates a control TCP connection to a
    server on port 21.
  • Client sends a user ID and password as part of
    FTP commands.
  • Server authorizes the client
  • Client opens a data TCP connection to a server
    on port 20.
  • Server maintains state current directory,
    earlier authentication.
  • An ftp client is allowed to initiate a transfer
    between two ftp servers.

13
FTP Commands
FTP
  • ltCRLFgt delimits each command (and reply).
  • Commands consist of four uppercase ASCII
    characters, some with optional arguments
  • USER username send a user identification to the
    server.
  • PASS password send the user password to the
    server.
  • PASV request the server to send back the IP
    port on which it will listen for a data TCP
    connection from the user.
  • LIST ask the server to send back its current
    directory contents through the data connection.
  • RETR filename retrieve a file from the current
    remote directory.
  • STOR filename store a file into the current
    remote directory.
  • Commands prompt replies from the server (ending
    with ltCRLFgt)
  • 331 Username OK, password required
  • 125 Data connection already open transfer
    starting
  • 425 Can't open data connection
  • 452 Error writing file

14
FTP Example
FTP
mfukuda_at_uw1-320-20 telnet ftp.tripod.com
21 Trying 209.202.240.80 Connected to
ftp.tripod.com (209.202.240.80). Escape character
is . 220 Welcome to Tripod FTP. USER
css432 331 Username set to css432. Now enter your
password. PASS 230 User css432 logged
on. LIST 425 Cant open data connection for
LIST. PASV 227 Entering Passiv Mode
(209,202,240,80,195,210) // Open another xterm
and telnet 209.202.240.80 50130 (195256210) //
Trying 209.202.240.80 // Connected to
ftp.tripod.com (209.202.240.80). // Escape
character is . // drwxr-xr-x 1 css432
Tripod 0 Sep 15 2122 cgi-bin //
-rw-r--r-- 1 css432 Tripod 26169 Sep 16
1828 ttcp.c // -rw-r--r-- 1 css432 Tripod
8236 Sep 15 2122 index.htm // drwxr-xr-x 1
css432 Tripod 0 Sep 16 1833 project
// Connection closed by foreign host. LIST 150
Opening ASCII mode data connection for LIST. 226
Transfer complete. QUIT 221 Goodbye Connection
closed by foreign host. mfukuda_at_uw1-320-20 _
15
FTP passive mode
FTP server
FTP client
TCP port 21 for control (persistent)
Client request connect( ), USER, PASS, LIST
Server Reply 220 server ready, 331 send
password, 230 login ok, 425 connection timeout
TCP port 20 for data transfer (one time)
FTP server
FTP client
TCP port 21 for control (persistent)
Client request connect( ), USER, PASS, PASV, LIST
Server Reply 220 server ready, 331 send
password, 230 login ok, 227 Entering Passive Mode
(140,142,12,173,195,54), 226 complete
TCP port 195256 54 49974 for data transfer
(one time)
data
16
FTP proxy command
(3) 227 Entering Passive Mode (140,142,12,173,195
,54)
FTP client
(1) USER, PASS, SYST
(2) USER, PASS, SYST
(3) TYPE I, PASV
(4) TYPE I, PORT (140,142,12,173,195,54), STOR
file
(5) RETR file
ftpgt open server1 ftpgt proxy open server2 ftpgt
proxy get file
(1) (2) (3)(5)
FTP Server 2
FTP Server 1
TCP port 195256 54 49974 for data transfer
(one time)
data
17
World Wide Web - HTTP
Web
  • Hypertext Transfer Protocol one-time TCP port 80
    connection for each request/response
  • client Browser requests, receives displays Web
    objects
  • server Web server sends objects in response to
    requests

18
HTTP Commands
Web
  • Client
  • Initiates a TCP connection to a server on port
    80.
  • Sends an HTTP request over this TCP connection
  • OPTIONS request information about available
    options
  • GET retrieve document identified in URL
  • HEAD retrieve document meta-information in URL
  • POST give information to server
  • PUT store document under specified URL
  • DELETE, TRACE, CONNECT
  • Receives an HTTP response
  • Server
  • Accepts a TCP connection from a client on port
    80.
  • Receives an HTTP request
  • Returns an HTTP response and terminates the TCP
    connection.
  • 1xx Informational
  • 2xx success
  • 3xx Redirection
  • 4xx Client error
  • 5xx Server error

19
HTTP Example
Web
mfukuda_at_uw1-320-20 telnet www.washington.edu
80 Trying 140.142.11.167... Connected to
www.washington.edu (140.142.11.167). Escape
character is ''. GET HTTP/1.1 200 OK Date Sun,
22 Feb 2004 090617 GMT Server Apache/1.3.28
(Unix) PHP/4.3.3 mod_perl/1.29 mod_backhand/1.2.2
Connection close Content-type
text/html lt!doctype html public -//W3C/DTD HTML
4.0 Transitional//ENgt lthtmlgtltheadgt
lt/bodygtlt/htmlgt Connection closed by foreign
host. mfukuda_at_uw1-320-20 _
20
Performance Improvement in Web
Web
  • Persistent TCP connections
  • Advantages
  • Disadvantages
  • Caching
  • Recently access pages can be cached at browsers
    and ISPs
  • Advantages
  • Disadvantages

21
Performance Improvement in Web
Web
  • Persistent TCP connections
  • Advantages
  • Eliminate the connection setup overhead
  • Eliminate repetitions of slow start phase
  • Disadvantages
  • Need to know the time period of connection
    server times out the connection.
  • Caching
  • Recently access pages can be cached at browsers
    and ISPs
  • Advantages
  • Disadvantages

22
Performance Improvement in Web
Web
  • Persistent TCP connections
  • Advantages
  • Eliminate the connection setup overhead
  • Eliminate repetitions of slow start phase
  • Disadvantages
  • Need to know the time period of connection
    server times out the connection.
  • Caching
  • Recently access pages can be cached at browsers
    and ISPs
  • Advantages
  • Reduce the number of HTTP accesses
  • Disadvantages
  • Need to purge out-of-date version of pages use
    expiration date and cache directives to cache or
    not to cache a given page

23
  • Reviews
  • RFC
  • Naming service DNS
  • Email SMTP, MIME, and IMAP
  • File transfer FTP
  • WWW HTTP
  • Exercises try the following examples by
    yourself.
  • Slide p8 (DNS)
  • Slide p12 (SMTP)
  • Slide p18 (FTP)
  • Slide p21 (HTTP)
Write a Comment
User Comments (0)
About PowerShow.com