Operating Systems and Networks (159.342)
Assignment 1: FTP server (Cross-platform, Active mode, IPv6-compliant),
Requirements
Your main task is to write a simple Cross-platform, Active mode FTP server program using the socket API (preinstalled in the operating system: Windows/Linux/MacOS). The FTP server must be able to process the following commands from the built-in FTP user agent: USER, PASS, OPTS, TYPE, LIST, EPRT and QUIT. Your FTP server program must satisfy the following requirements:
1. It should be RFC 959 protocol-, RFC 2428 protocol- and IPv6-compliant.
2. It should not use data structures that work only on IPv4 addresses (penalty applies).
- It must compile using the recommended g++ 12.2.0 compiler (see download link from our Stream website).
- It must be cross-platform but will be tested only on Windows 10.
5. It should be able to accept an optional ephemeral port to listen to, as one of its arguments (e.g. server 1122)
6. If the port number is not specified, it should use port 1234 as default.
The FTP server will be tested using the built-in FTP client in Windows 10 (IPv6), using simple commands such as:
· dir
· binary
· ascii
· get <filename>
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. It is also highly recommended that you try to interact with a real ftp server (e.g. Internet Information Services (IIS) - ftp server), 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 <filename>), including error handling in IPv6. Your program should work with binary files (e.g. jpg files)
- 1 mark for TYPE <mode> 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
· This assignment is worth 10 marks. Plagiarized works will be penalized.