Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Operating Systems and Networks (159.342)

Assignment 1: FTP server (Cross-platform, Active mode, IPv6-compliant), due on the 16th of April (Sunday)

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, PORT, 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.  

2. It should not use data structures that work only on IPv4 addresses (penalty applies).

3. It must compile using the recommended g++ 12.2.0 compiler (see download link from our Stream website).    

4. 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 (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 (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. 

Submission Instructions:

1. Submit your complete C/C++ program electronically via Stream.

2. Use the following filename for your FTP server: server.cpp

3. Submit the makefile for building your codes.  The makefile should suffice to build your codes.

4. As a backup, if you developed your program using an IDE, such as VSCODE or Clion, also submit the complete support files (e.g. CMakeLists.txt, project file, *.sln, *.JSON,  etc.), for building your codes.

5. Compress (zip) your files (bundled together into one zip file) before submitting.  

6. Attach a brief documentation of how your system works, including snap shots of sample interactions demonstrating EACH of the required commands, and an accomplished checklist 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 developing and testing your FTP server codes

 

Note that your cross-platform FTP server must be able to run on Windows 10.

3

Compiler used

 

g++ 12.2.0 is required.  Your program will be compiled and marked using this.

4

IDE used

 

Provide the IDE name and version (e.g. SublimeText 4, Visual Studio Code v.1.76.2, CLion 2022.1.3)

5

makefile: Have you included the makefile required to build (i.e. compile and link) your codes?

Yes/No

Indicate ‘Yes’ or ‘No’.  This file is required for marking, even if you have used Clion, Visual Studio Code, etc. to develop your codes.  The makefile should suffice to build your codes.

6

Source Codes (*.cpp, *.h): Have you included all your source code files?

Yes/No

Indicate ‘Yes’ or ‘No’.  This is very important, as your program will be recompiled.

7

Other Support Files: Have you submitted other supporting files required to compile your codes and test it? i.e. CMakeLists.txt, *.sln, .vcxproj, *.json, etc.

Yes/No

Indicate ‘Yes’ or ‘No’.  Make sure that you submit all the supporting files if you developed your codes using CLion or Visual Studio.  This will only be used as a back-up approach to building your codes.

8

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

9

Did you include snapshots of sample interactions (one for each required command) in your documentation?

Yes/No

Indicate ‘Yes’ or ‘No’.

Snapshots are required, as part of the documentation.