Upload
mrphanhieuqt
View
221
Download
0
Embed Size (px)
Citation preview
8/9/2019 H thng vin thng - Chng 26
1/15
1
Chapter 26
SMTP
and
FTP
26.1 Electronic Mail26.1 Electronic Mail
Sending/Receiving Mail
Addresses
User Agent
MIME
Mail Transfer Agent
Mail Access Protocols
8/9/2019 H thng vin thng - Chng 26
2/15
2
Figure 26.1 Format of an email
Figure 26.2 Email address
8/9/2019 H thng vin thng - Chng 26
3/15
3
Figure 26.3 User agent
Some examples of command-driven
user agents are mail, pine, and elm.
NoteNote::
8/9/2019 H thng vin thng - Chng 26
4/15
4
Some examples of GUI-based user
agents are Eudora, Outlook, and
Netscape.
NoteNote::
Figure 26.4 MIME
8/9/2019 H thng vin thng - Chng 26
5/15
5
Figure 26.5 MIME header
Table 26.1Table 26.1 Data types and subtypes in MIMEData types and subtypes in MIME
General binary data (8-bit bytes)Octet-Stream
Adobe PostScriptPostScriptApplication
Single-channel encoding of voice at 8 KHzBasicAudio
Video is in MPEG formatMPEGVideo
Video is in GIF formatGIF
Image is in JPEGJPEGImage
Body is a reference to another messageExt. Body
Partial
RFC822
Alternative
Digest
Parallel
Mixed
PlainSubtype
Body is a fragment of a bigger message
Body is an encapsulated message
Message
Parts are different versions of the same message
Similar to mixed, but the default is message/RFC822
Same as above, but no order
Body contains ordered parts of different data types
Multiport
Unformatted textTextDescriptionType
8/9/2019 H thng vin thng - Chng 26
6/15
6
Table 26.2Table 26.2 ContentContent--transfer encodingtransfer encoding
Non-ASCII characters are encoded as an equal sign followed by anASCII code
6-bit blocks of data are encoded into 8-bit ASCII characters
Non-ASCII characters with unlimited-length lines
Non-ASCII characters and short lines
ASCII characters and short lines
Description
Base64
Binary
8bit
7bit
Type
Category
Figure 26. 6 Base64
8/9/2019 H thng vin thng - Chng 26
7/15
7
Table 26.3Table 26.3 Base64 encoding tableBase64 encoding table
2
1
0
z
y
x
w
v
u
t
s
Code
63
62
61
60
59
58
57
56
55
Value
/
+
9
8
7
6
5
4
3
Code
43
42
41
40
39
38
37
36
35
34
33
Value
r
q
p
o
n
m
l
k
j
i
h
Code
54
53
52
51
50
49
48
47
46
45
44
Value
V
U
T
S
R
Q
P
O
N
M
L
Code
32
31
30
29
28
27
26
25
24
23
22
Value
g
f
e
d
c
b
a
Z
Y
X
W
Code
21
20
19
18
17
16
15
14
13
12
11
Value
K
J
I
H
G
F
E
D
C
B
A
Code
9
10
6
7
8
3
4
5
2
1
0
Value
Figure 26.7 Quoted-printable
8/9/2019 H thng vin thng - Chng 26
8/15
8
Figure 26.8 MTA client and server
Figure 26.9 Commands and responses
8/9/2019 H thng vin thng - Chng 26
9/15
9
Figure 26.10 Email delivery
Figure 26.11 POP3
8/9/2019 H thng vin thng - Chng 26
10/15
10
26.2 File Transfer26.2 File Transfer
Connections
Communication
File Transfer
User Interface
Anonymous
FTP uses the services of TCP. It needs
two TCP connections. The well-known
port 21 is used for the control
connection, and the well-known port
20 is used for the data connection.
NoteNote::
8/9/2019 H thng vin thng - Chng 26
11/15
11
Figure 26.12 FTP
Figure 26.13 Using the control connection
8/9/2019 H thng vin thng - Chng 26
12/15
12
Figure 26.14 Using the data connection
Figure 26.15 File transfer
8/9/2019 H thng vin thng - Chng 26
13/15
13
Example 1Example 1
Figure 26.16 (next slide) shows an example of how a file is stored.
1. The control connection is created, and several control
commands and responses are exchanged.
2. Data are transferred record by record.
3. A few commands and responses are exchanged to close the
connection.
Figure 26.16 Example 1
8/9/2019 H thng vin thng - Chng 26
14/15
14
Table 26.4Table 26.4 List of FTP commands in UNIXList of FTP commands in UNIX
!, $, account, append, ascii, bell, binary, bye, case, cd, cdup,close, cr, delete, debug, dir, discount, form, get, glob, hash, help,
lcd, ls, macdef, mdelete, mdir, mget, mkdir, mls, mode, mput,nmap, ntrans, open, prompt, proxy, sendport, put, pwd, quit,quote, recv, remotehelp, rename, reset, rmdir, runique, send,status, struct, sunique, tenex, trace, type, user, verbose,?
Commands
Example 2Example 2
We show some of the user interface commands that accomplish the same task as in
Example 1. The user input is shown in boldface. As shown below, some of the commands
are provided automatically by the interface. The user receives a prompt and provides only
the arguments.
$ ftp challenger.atc.fhda.edu
Connected to challenger.atc.fhda.edu220 Server ready
Name: forouzan
Password: xxxxxxxftp > ls /usr/user/report
200 OK150 Opening ASCII mode
......................
226 transfer complete
ftp > close221 Goodbye
ftp > quit
8/9/2019 H thng vin thng - Chng 26
15/15
15
Example 3Example 3
We show an example of using anonymous FTP. We connect to internic.net, where weassume there are some public data available.
$ ftp internic.netConnected to internic.net220 Server readyName: anonymous331 Guest login OK, send "guest" as passwordPassword: guestftp > pwd257 '/' is current directoryftp > ls200 OK150 Opening ASCII modebin
...ftp > close221 Goodbyeftp > quit