Operating Systems and Networks (159.342)
Assignment 1: FTP server (Active Mode, IPv6-compliant), due on the 12th of April
Requirements
Your main task is to write a simple Active FTP server program using the socket API (Winsock2). The FTP server must be able to process the following commands from the built-in FTP user agent: USER, PASS, OPTS, TYPE, LIST, EPRT, RETR and QUIT. Your FTP server program must satisfy the following requirements:
1.It should be RFC 959 protocol-, RFC 2428 protocol- and IPv6-compliant. It should not use data structures that work only on IPv4 addresses (penalty applies).
2.It must compile using the recommended g++ 11.2.0 compiler (see link from our Stream website).
3.It must run on Windows 10.
4.It should be able to accept an optional ephemeral port to listen to, as one of its arguments (e.g. server 1122)
5.If the port number is not specified, it should use port 1234 as default.
The FTP server will be tested using a Windows 10 or Ubuntu Linux FTP user agent (IPv6), using simple commands such as:
dir
binary
ascii
get
For testing purposes, include one authorized user entry in your server with the user name: napoleon, and password: 342
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.auckland.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 allocation and 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 ), including error handling in IPv6. Your program should work with binary files (e.g. jpg files)
1 mark for TYPE command; mode is either ‘I’ (for image), or ‘A’ (for ASCII). To test the image/binary mode, try transferring a jpg image file from your FTP server.
1 mark for the brief documentation and accomplished checklist
Bonus marks may be awarded if you add lots of extra features. Show snapshots in your documentation. You could receive a bonus of up to 2 marks, depending on the difficulty of implementing those extra features, as well as the quality and robustness of your implementation.
This assignment is worth 10 marks (+bonus). Plagiarized works will be penalized.
Submission Instructions:
1.Submit your C/C++ program electronically via Stream.
2.Use the following filename for your FTP server: server.cpp
3.If your program requires a makefile, project file, or some supporting files, include them all in the submission. Compress (zip) your files (bundled together into one zip file) before submitting.
4.Attach a brief documentation of how your system works, including some snap shots of sample interactions demonstrating EACH of the required commands.
5.Submit the accomplished checklist in order to allow for accurate marking of your assignment.
CHECK LIST
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++ 11.2.0 is required
4 IDE used (e.g. SublimeText 3, ScITE)
5 Required Functionalities 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.
EPRT command full/partial/none
LIST command full/partial/none
RETR command full/partial/none
TYPE command full/partial/none
Client can successfully connect to the FTP server in IPv6 full/partial/none
Client can disconnect to the FTP server (after successfully connecting previously) full/partial/none
Client can reconnect to the FTP server (after disconnecting previously) full/partial/none
6 Did you include snap shots of sample interactions (one for each required command) in your documentation? Yes/No indicate ‘Yes’ or ‘No’
7 Did you add any extra features that were not required in the assignment? (You could receive a bonus of up to 2 marks, depending on the difficulty of implementing those extra features, as well as the quality and robustness of your implementation) Yes/No. (If Yes, list down the extra features you have added, show snap shots that they actually work, and specify how to utilize them.) (e.g. successfully implemented a Cross-platform server, successfully implemented other FTP commands (e.g. CWD, STOR and PWD commands)