Socket programming – FTP server (Active Mode, IPv6-compliant)
Requirements
Your main task is to write a simple Active FTP server program using windows sockets. The FTP server must be able to run in Windows 10 and process USER, PASS, OPTS, TYPE, LIST, EPRT, RETR and QUIT command requests from a (built-in) Windows 10 or Ubuntu Linux FTP client.
Your FTP server program must be RFC 959 protocol-, RFC 2428 protocol- and IPv6-compliant. Do not use data structures that work only on IPv4 addresses (penalty applies).
Your server must be able to accept an optional ephemeral port to listen to, as one of its arguments (e.g. server 1155)
If the port number is not specified, use port 1234 as default.
It will be tested using a Windows 10 or UBUNTU Linux FTP user agent, using simple commands such as:
dir
get
binary
ascii
As default setting, use binary mode to transfer files.
For testing purposes, include one authorized user entry in your server with the user name: napoleon, and password: 334
Guidelines
Learn about the protocol commands and response messages that need to be issued. Refer to materials provided in the stream web site (i.e. RFC 959, RFC 2428, lecture slides, sample codes). It is also highly recommended that you try to interact with a real ftp server (ftp.massey.ac.nz), to see how it actually responds to your requests.
When the FTP server receives an OPTS command, simply return 550 unrecognized command.
Remember that the FTP protocol requires two parallel TCP connections: one in port 21 and a data connection in port 20. The machines in the lab may not allow users to bind applications on these ports. Therefore, your program should allow for any valid ephemeral port i.e. [1024, 65535] as an alternative port number.
Marking the assignment:
The assignment is going to be marked based on functionality. The server should not crash if the user tries to issue commands that are not implemented. The marks are distributed as follows:
2 marks for correct connection/disconnection and resource de-allocation (the server should allow for reconnection after errors, etc.)
2 marks for the EPRT command, including error handling in IPv6
2 marks for LIST command, including error handling, in IPv6
2 marks for the RETR command (get
1 mark for TYPE
1 mark for the documentation and accomplished checklist
1 Bonus mark if your server is cross-platform (can run at least on Ubuntu Linux and Windows 10)
Up to 2 Bonus marks will be given to those who can implement the CWD and PWD commands correctly. The user must be able to change from one directory to another, then download or upload files. User access to folders must be limited relative to the server’s root directory. For security purposes, any user must not be able to access directories higher than the ftp root, but only those below it. In addition, the user must be able to print the current working directory by typing PWD. Use the following directory structure:
ftp_root
secret (this folder must be accessible only to authorised users)
pub (this folder is accessible to any user)
Notes:
1 – Submit your program electronically via Stream.
Use the following name for your filename: server.cpp
If your program requires a makefile, or a project file, or some supporting files, include them all. However, you should compress (zip) your files (bundled together into one zip file).
Your program should compile using the recommended g++ 8.2.0 compiler (see link from our Stream website).
Your FTP server codes should compile and run on Windows 10.
Your FTP server should be able to communicate with the built-in FTP client provided by the Windows 10 or Ubuntu Linux operating system.
Attach a brief documentation of how your system works, show snap shots of sample interactions demonstrating EACH of the required commands. Submit the accomplished checklist as well.
2 – This assignment is worth 10 marks. Plagiarised works will be penalized.
Checklist/Other technical details
(Include this page in your submission)
Please accomplish the following check list in order to allow for accurate marking of your assignment.
Item
your assignment details
Comments
1
Names and ID numbers of Group Members
(maximum of 3 members in a group)
2
Operating System(s) used for testing your FTP server codes
Note that your FTP server should be able to run on Windows 10.
3
Compiler used
g++ 8.2.0 is required
4
IDE used
(e.g. SublimeText 3, ScITE)
5
Required Functionalities
EPRT command
full/partial/none
Indicate ‘full’, if you have completed the implementation of the required command, ‘partial’, if you are only submitting a partial implementation, or ‘none’, if not accomplished.
LIST command
full/partial/none
RETR command
full/partial/none
TYPE command
full/partial/none
6
Snap shots of sample interactions: one for each required command.
Yes/No
indicate ‘Yes’ or ‘No’
7
Extra work done (Max Bonus of 3 marks)
Yes/No. (If Yes, list down the extra features you have added, and specify how to utilize them.)
(e.g. successfully implemented a Cross-platform server, successfully implemented the CWD and PWD commands)
Assignment_1