File Transfer Protocol: CS-328 Dick Steflik
File Transfer Protocol: CS-328 Dick Steflik
CS-328
Dick Steflik
FTP
• RFC 959
• uses two TCP Ports
– one for control
– one for data transfers
• command-response protocol
• control port uses telnet protocol to negotiate
session
– US-ASCII
– <crlf> is end-of-line character
Active Mode FTP
• Client connect from a random unprivileged port (n > 1023) to the servers
command port (21) and sends port command to tell server to connect to n+1
then listens on the next higher unprivileged port (n+1) for server responses.
The server connects from it’s data port (20) to the client data port (n+1)
Server Client
20 21 1026 1027
4
Passive Mode FTP
• Client opens two random unprivileged ports ( n > 1023 and n+1; ex 1026 and
1027) and connects the first port (n) to server command port 21 and issues a
pasv command (server sends port to use for data); client connects to servers
specified data port, server completes connection.
Server Client
4
Transfer Files in a Heterogeneous Host Environment