FTP代写:CS159-Socket-Programming-FTP-Server

Requirement

Your task is to create a very simple FTP server program using sockets.

  1. The server needs to be able to interpret the protocol commands, including: LIST, RETR, STOR
  2. The client should be a standard command line FTP client application (available on your OS). The application commands that should work from the client are:
    1
    2
    3
    dir (or ls)
    get <filename>
    put <filename>

Assume that the files to be transferred are text only (ASCII rather than binaries). There is no need to implement text X binary modes.

Part 1

This exercise makes use of the FTP protocol directly from a command line application. You have probably used FTP before, but in a transparent way (perhaps via a browser).

FTP is an acronym used with different meanings, each with its set of commands:

FTP protocol commands (e.g., USER, PASV, PORT etc)

FTP application commands, associated with a FTP client (e.g., get, put, dir etc).

When using different Operating Systems one might find that the FTP application works in different ways, even though they may be using the same FTP protocol. The commands described below should work in most OS. However different FTP clients may have incomplete implementations or use nonstandard FTP application commands.

To start the exercise:

  1. 1) Open a terminal
  2. 2) Issue the command:

Part 2

We have seen some examples using the application called telnet to connect to servers listening to certain ports (see some examples in Chapter 2). Does that work with FTP?

Part 3

Understanding the difference between FTP “protocol commands” and “application commands”:

We have looked at protocol commands, such as: RETR, USER, PASS, STOR etc.

Also, there are application commands with an FTP client: get, put, ls etc

Notes:

Your submission has to be a single source file (server) compatible with GCC (if using other compilers to develop the request, make sure the final source compiles on GCC). Submit to Stream.

This request is worth 10 marks.

You may lose marks for late requests.