Communication between client occurs via two separate socket connections as
shown in the following diagram:
-------------
|/---------\|
|| User || --------
||Interface|<--->| User |
|\----^----/| --------
---------- | | |
|/------\| FTP Commands |/----V----\|
||Server|<---------------->| User ||
|| PI || FTP Replies || PI ||
|\--^---/| |\----^----/|
| | | | | |
-------- |/--V---\| Data |/----V----\| --------
| File |<--->|Server|<---------------->| User |<--->| File |
|System| || DTP || Connection || DTP || |System|
-------- |\------/| |\---------/| --------
---------- -------------
Server-FTP USER-FTP
[diagram from RFC 959]
All FTP commands are issued through control connection from the User PI (Protocol Interpreter) to the Server PI. Actual data is transferred via the data connection between the Server DTP (Data Transfer Process) and and User DTP.
jftpd is an implementation of the left hand side of the above diagram. The source files associated with this diagram are:
ServerPI.java ServerDTP.java
The jftpd server is a multithreaded application listening on port 21 for FTP requests. For each request, a new ServerPI thread is started and an associated ServerDTP object is created to handle data transfers. The main loop that accepts connections is defined in Server.java.
Data representations and transmission modes have been isolated in the following source files:
Representation.java - AsciiRepresentation.java - ImageRepresentation.java TransmissionMode.java - StreamTransmissionMode.java
The ServerPI is responsible for interpreting all commands issued from the control connection. There is a separate method to handle each command, and the reflection API is used to lookup the appropriate method to handle each command.