home personal workZone travel about
Java FTP Server and Client

This project was part of one of my courses - 2nd yr I think and I found the backup lying on a dusty cd so decided to put it up here. I havent bothered looking up the code again so do some work figuring out how to get it to work.... look for main methods, one for server and one for client. The GUI part is just for fun, command line all the work anyway. DONT contact me for any problems....figure them out and then maybe help me post a correction for others copying stuff off the internet!

The FTP Server and Client have been successfully implemented using UDP. Once the server is started clients can connect to it and use the familiar FTP commands. Implementation in Java makes it platform independent and we can successfully transfer files running server in Linux and client on Windows and vice-versa.

Features Provided:
The client supports the following commands:

ls Get directory listing of current directory on server.
cd [path] Change directory currently in.
pwd Display current path.
get [filename] retrieves the filename if in current directory
help or ? Display commands available.
quit or bye Close client.
bin Set transfer mode to Binary (Default mode)
ascii Set transfer mode to ASCII

Error Checking

For reliable transfer over a packet based connection the stop and wait ARQ and go-back-to N ARQ have been implemented. All commands and files are reliably transferred based on these methods respectively. Packet level error is checked using Checksum. In case of inability to send/receive the client/server is notified.

Program Results/Measurements

The following observations were made:

File Size (bytes)

Packet Size (bytes)

Number of Packets

Transfer Time (ms)

Throughput (bps)

Avg Packet Delay (ms)

113727

512

222

610

1491501.63

2.7477

211478

512

413

1260

1342717.46

3.0508

19463736

700

27805

63610

2447883.79

2.2877

113727

700

162

550

1654210.90

3.3950

113727

1024

111

330

2757018.18

2.9729

The packet delays are due to time to send/receive the ACK, and disk I/O time, and other processing time. Increasing the packet size shows a decrease in transfer time, however larger packets mean greater loss if the packet is lost and retransmitted. Performance can be improved by using a dynamically allocated timeout value and packet size depending on network conditions. In case of a reliable/fast link the packet size can be increased and timeout decreased and vice versa for a unreliable/slow link.

GUI Client

The Client has been implemented in an intuitive Graphical User Interface version. The GUI has been implemented solely using the java.awt.* classes. Specifically Swing was not used to focus more on programming.

Download Java Source

BTW... in those days I didn't know javadoc so good luck!!