ftp protocol details
DESCRIPTION
FTP Protocol Details. Tips for the assignment. Socket Programming using TCP. controlled by application developer. controlled by application developer. process. process. socket. socket. TCP with buffers, variables. controlled by operating system. TCP with buffers, variables. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/1.jpg)
1
Tips for the assignmentTips for the assignment
![Page 2: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/2.jpg)
2
Socket: a door between application process and end-end-transport protocol (UDP or TCP)
TCP service: reliable transfer of bytes from one process to another
process
TCP withbuffers,
variables
socket
controlled byapplicationdeveloper
controlled byoperating
system
host orserver
process
TCP withbuffers,
variables
socket
controlled byapplicationdeveloper
controlled byoperatingsystem
host orserver
Internet
Socket Programming using TCPSocket Programming using TCP
![Page 3: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/3.jpg)
3
![Page 4: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/4.jpg)
4
client
Client socket
server
Welcome socket
Connection socket
time
Client socket
bytes
Client Sockets & Server SocketsClient Sockets & Server Sockets
![Page 5: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/5.jpg)
5
Client/server socket interaction: Client/server socket interaction: TCPTCP
wait for incomingconnection requestconnectionSocket =accept()
create socket,port=x, forincoming request:welcomeSocket =
Socket()
create socket,connect to hostid, port=xclientSocket =
Socket()
closeconnectionSocket
read reply fromclientSocket
closeclientSocket
ServerServer (running on hostid) ClientClient
send request usingclientSocketread request from
connectionSocket
write reply toconnectionSocket
TCP connection setup
Application 2-5
![Page 6: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/6.jpg)
6
socket
bind
listen
loop "forever"
{
accept /* by creating new socket */
/* process the client’s request */
loop until done
{
receive/send
}
closesocket(newsocket)
}
Simple Server Pseudo-CodeSimple Server Pseudo-Code
![Page 7: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/7.jpg)
7
socket
connect
/* process the client’s request */
loop until done
{
send/receive
}
closesocket(socket)
Simple Client Pseudo-CodeSimple Client Pseudo-Code
![Page 8: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/8.jpg)
8
socket
bind
listen
loop "forever"
{
accept /* by creating new socket */
/* process the clients request */
loop until done
{
receive/send
}
closesocket(newsocket)
}
Proper Ordering of Proper Ordering of SendSend and and RecvRecv
socket
connect
/* process the clients request */
loop until done
{
send/receive
}
closesocket(socket)
![Page 9: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/9.jpg)
9
Test the Test the TCPTCP Client-Server Client-Server CodesCodes
Run ServerWindows.cServerWindows.c Compile ClientWindows.cClientWindows.c, look for the
executable. Run ClientWindows.cClientWindows.c from the command
prompt to connect to the server: ClientWindows localhost ClientWindows localhost 12341234 Alternatively, use IpConfig to find out what your IP
address is: (e.g. 130.123.123.111), then connect to the server using:• ClientWindows ClientWindows 130.123.123.111130.123.123.111 12341234
Let’s see how to use the compiler’s Let’s see how to use the compiler’s debug debug mode mode to trace the exchange of messages.to trace the exchange of messages.
![Page 10: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/10.jpg)
10
![Page 11: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/11.jpg)
11
FTP (Multiple Clients)FTP (Multiple Clients)
In TCP, the Server should be running already prior to a Client connecting to it
SSServerServer
TCP Control SocketTCP Control Socket
CCTCP Control SocketTCP Control Socket
Listening Listening SocketSocket
DIRDIR
TCP Active Data SocketTCP Active Data Socket
Port 127,0,0,1,Port 127,0,0,1,6,116,11
QuitQuit
After file transferAfter file transfer
![Page 12: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/12.jpg)
12
![Page 13: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/13.jpg)
13
FTP OperationFTP Operation
Source: Computer Networking and the Internet (5/e) by Fred Halsall
CLIENTCLIENT
SERVERSERVER
Control connection
Data connection
Note that Ports 1216 & 1217 are ephemeral ports. Any port [1024, 65535] will work.
![Page 14: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/14.jpg)
14
FTP CommandsFTP Commands
COMMAND DESCRIPTION
USER username User name on the FTP server
PASS password User’s password on the FTP server
SYST Type of operating system requested
TYPE type File type to be transferred: A (ASCII), I (Image/Binary)
PORT n1,n2,n3,n4,n5,n6 Client IP address (n1-n4) and port number (n5, n6)
RETR filename.type Retrieve (get) a file
STOR filename.type Store (put) a file
LIST filelist List files or directories
QUIT Log off from server
Source: Computer Networking and the Internet (5/e) by Fred Halsall
![Page 15: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/15.jpg)
15
FTP Reply CodesFTP Reply Codes
REPLY DESCRIPTION
11yz Positive reply, wait for another reply before sending a new command
22yz Positive reply, a new command can be sent
33yz Positive reply, another command is awaited
44yz Negative reply, try again
55yz Negative reply, do not retry
x00z Syntax
x11z Information
x22z Control or data connection
x33z Authentication
x44z Unspecified
x55z File status
Source: Computer Networking and the Internet (5/e) by Fred Halsall
![Page 16: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/16.jpg)
16
ActiveActive FTP (or Standard ) FTP (or Standard )
Standard (or PORT or Active)The Standard mode FTP client sends PORT commands to the FTP server. These commands are sent over the FTP command channel when establishing the FTP session.
OperationOperationStandard mode FTP clients first establish a connection to TCP port 21 on the FTP server. This connection establishes the FTP command channel. The client sends a PORT command over the FTP command channel when the FTP client needs to send or receive data, such as a folder list or file. The PORT command contains information about which port the FTP client receives the data connection on. In Standard mode, the FTP server always starts the data connection from TCP port 20. The FTP server must open a new connection to the client when it sends or receives data, and the FTP client requests this by using the PORT command again.
![Page 17: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/17.jpg)
17
PassivePassive FTP (or PASV) FTP (or PASV)
Passive (or PASV)The Passive mode client sends PASV commands to the FTP Server.
OperationPassive mode FTP clients also start by establishing a connection to TCP port 21 on the FTP server to create the control channel. When the client sends a PASV command over the command channel, the FTP server opens an ephemeral port (between 1024 and 5000) and informs the FTP client to connect to that port before requesting data transfer. As in Standard mode, the FTP client must send a new PASV command prior to each new transfer, and the FTP server will await a connection at a new port for each transfer.
![Page 18: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/18.jpg)
18
p. 50p. 50, RFC 959, RFC 959
![Page 19: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/19.jpg)
19Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive open
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 20: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/20.jpg)
20Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 21: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/21.jpg)
21Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 22: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/22.jpg)
22Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 23: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/23.jpg)
23Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 24: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/24.jpg)
24Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 25: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/25.jpg)
25Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 26: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/26.jpg)
26Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 27: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/27.jpg)
27Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
SYST
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 28: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/28.jpg)
28Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
SYST215 UNIX Type:X Version:Y
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 29: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/29.jpg)
29Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
get <filename.type>
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 30: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/30.jpg)
30Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PORT n1-n6 get <filename.type>
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 31: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/31.jpg)
31Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PORT n1-n6200 PORT command successful
get <filename.type>
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 32: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/32.jpg)
32Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PORT n1-n6200 PORT command successful
get <filename.type>
RETR <filename.type>
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 33: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/33.jpg)
33Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PORT n1-n6200 PORT command successful
get <filename.type>
RETR <filename.type>
150 opening ASCII mode data connection
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 34: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/34.jpg)
34Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PORT n1-n6200 PORT command successful
get <filename.type>
RETR <filename.type>
150 opening ASCII mode data connection
Server does an active open to Port n5, n6
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 35: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/35.jpg)
35Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PORT n1-n6200 PORT command successful
get <filename.type>
RETR <filename.type>
150 opening ASCII mode data connectionSend file through data connection
Server does an active open to Port n5, n6
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 36: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/36.jpg)
36Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
timetime time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PORT n1-n6200 PORT command successful
get <filename.type>
RETR <filename.type>
150 opening ASCII mode data connectionSend file through data connection
Server does an active open to Port n5, n6
226 File transfer complete
User prompted for a conmand
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 37: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/37.jpg)
37Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PORT n1-n6200 PORT command successful
get <filename.type>
RETR <filename.type>
150 opening ASCII mode data connectionSend file through data connection
Server does an active open to Port n5, n6
226 File transfer complete
User prompted for a conmand
QUIT
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 38: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/38.jpg)
38Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PORT n1-n6200 PORT command successful
get <filename.type>
RETR <filename.type>
150 opening ASCII mode data connectionSend file through data connection
Server does an active open to Port n5, n6
226 File transfer complete,
User prompted for a conmand
QUIT221 Goodbye
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 39: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/39.jpg)
39Source: Computer Networking and the Internet (5/e) by Fred Halsall
ACTIVEACTIVE FTP Operation FTP Operation
CLIENTCLIENTSERVERSERVER
PortPort2020
PortPort2121
Data connection control connection
PortPort11201120
PortPort11211121
Data connectioncontrol connection
time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PORT n1-n6200 PORT command successful
get <filename.type>
RETR <filename.type>
150 opening ASCII mode data connectionSend file through data connection
Server does an active open to Port n5, n6
226 File transfer complete,
User prompted for a conmand
QUIT221 GoodbyeServer closes data connection
first , then control connection
![Page 40: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/40.jpg)
40
![Page 41: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/41.jpg)
41Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVEPASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime time time
Passive open
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 42: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/42.jpg)
42Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVEPASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 43: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/43.jpg)
43Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 44: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/44.jpg)
44Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 45: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/45.jpg)
45Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 46: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/46.jpg)
46Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection Data connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 47: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/47.jpg)
47Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 48: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/48.jpg)
48Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 49: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/49.jpg)
49Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
PortPort11201120
PortPort11211121
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
SYST
Data connectioncontrol connection
![Page 50: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/50.jpg)
50Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
SYST215 UNIX Type:X Version:Y
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 51: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/51.jpg)
51Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PASV
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 52: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/52.jpg)
52Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PASV
227 Entering PASV mode (192,168,150,90,195,149)
Port2024
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 53: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/53.jpg)
53Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PASV
227 Entering PASV mode (192,168,150,90,195,149)
Port2024
dir
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 54: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/54.jpg)
54Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PASV
227 Entering PASV mode (192,168,150,90,195,149)
Port2024
LIST dir
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 55: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/55.jpg)
55Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PASV
227 Entering PASV mode (192,168,150,90,195,149)
Port2024
LIST dir150 Opening ASCII mode data connection for file list
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 56: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/56.jpg)
56Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PASV
227 Entering PASV mode (192,168,150,90,195,149)
Port n5, n6(or Port 2024 in this
example)
LIST dir150 Opening ASCII mode data connection for file list
Client does an active open to Port n5,n6
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 57: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/57.jpg)
57Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime time time
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PASV
227 Entering PASV mode (192,168,150,90,195,149)
Port n5, n6(or Port 2024 in this
example)
LIST dir150 Opening ASCII mode data connection for file list
Client does an active open to Port n5,n6
Send file through data connection
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 58: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/58.jpg)
58Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PASV
227 Entering PASV mode (192,168,150,90,195,149)
Port n5, n6(or Port 2024 in this
example)
LIST dir150 Opening ASCII mode data connection for file list
Client does an active open to Port n5,n6
Send file through data connection226 File transfer complete
User is prompted for a command
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 59: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/59.jpg)
59Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PASV
227 Entering PASV mode (192,168,150,90,195,149)
Port n5, n6(or Port 2024 in this
example)
LIST dir150 Opening ASCII mode data connection for file list
Client does an active open to Port n5,n6
Send file through data connection226 File transfer complete
User is prompted for a commandQUIT
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 60: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/60.jpg)
60Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PASV
227 Entering PASV mode (192,168,150,90,195,149)
Port n5, n6(or Port 2024 in this
example)
LIST dir150 Opening ASCII mode data connection for file list
Client does an active open to Port n5,n6
Send file through data connection226 File transfer complete
User is prompted for a commandQUIT
221 Goodbye
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 61: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/61.jpg)
61Source: Computer Networking and the Internet (5/e) by Fred Halsall
PASSIVE PASSIVE FTP OperationFTP Operation
CLIENTCLIENTSERVERSERVER
PortPort20242024
PortPort2121
Data connection control connection
timetime
Passive openActive open
TCP control connection to Port 21 established
220 FTP server ready
USER <username>
331 password required
PASS <password>
220 user <username> logged in
PASV
227 Entering PASV mode (192,168,150,90,195,149)
Port n5, n6(or Port 2024 in this
example)
LIST dir150 Opening ASCII mode data connection for file list
Client does an active open to Port n5,n6
Send file through data connection226 File transfer complete
User is prompted for a commandQUIT
221 GoodbyeServer closes data connection first , then control connection
PortPort11201120
PortPort11211121
Data connectioncontrol connection
![Page 62: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/62.jpg)
63
Security IssuesSecurity Issues
Firewall administrators may not want to use Passive Passive mode FTP servers mode FTP servers because the FTP server can open any ephemeral port number.
Many FTP servers are configured with an ephemeral ephemeral port rangeport range of 10241024 through 6553565535.
Firewall configurations that allow full access to all ephemeral ports for unsolicited connections may be considered unsecuredunsecured.
http://support.microsoft.com/kb/323446
![Page 63: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/63.jpg)
66
How to change the Internet Explorer How to change the Internet Explorer FTP Client modeFTP Client mode
Start Internet Explorer. On the Tools menu, click Internet Options. Click the Advanced tab. Under Browsing, click to clear the Enable folder
view for FTP sites check box. Click to select the Use Passive FTP Passive FTP (for firewall
and DSL modem compatibility) check box. Internet Explorer behaves as a Standard mode FTP client if you select
the Enable folder view for FTP sites check box, even if you also select the Use Passive FTP check box. If you clear the Enable folder view for FTP sites check box and then select the Use Passive FTP check box, Internet Explorer behaves as a Passive mode FTP client.
![Page 64: FTP Protocol Details](https://reader036.vdocuments.pub/reader036/viewer/2022070410/56814659550346895db376f0/html5/thumbnails/64.jpg)
67
The EndThe End