Next File Transfer Protocol =========================== Introduction ------------ Next File Transfer uses a simple protocol where a 2 character code defines a message type. The following are standard compents of a message: +------------+------------------------------------------------------+ | | 6 ASCII digits making up a zero-padded number | +------------+------------------------------------------------------+ | | A stream of N bytes | +------------+------------------------------------------------------+ Put File -------- The format of the message from the client is: +------------+------------------------------------------------------+ | PF | Put file command | +------------+------------------------------------------------------+ | | Length of filename | +------------+------------------------------------------------------+ | | The filename | +------------+------------------------------------------------------+ | | Length of the data for the file | +------------+------------------------------------------------------+ | | The data | +------------+------------------------------------------------------+ The server responds with either: +------------+------------------------------------------------------+ | OK | The command completed OK | +------------+------------------------------------------------------+ or: +------------+------------------------------------------------------+ | !E | There was an error writing the file | +------------+------------------------------------------------------+ Get File -------- The format of the message from the client is: +------------+------------------------------------------------------+ | GF | Get file command | +------------+------------------------------------------------------+ | | Length of filename | +------------+------------------------------------------------------+ | | The filename | +------------+------------------------------------------------------+ The server responds with either: +------------+------------------------------------------------------+ | OK | The command completed OK. The file contents will | | | follow. | +------------+------------------------------------------------------+ | | Length of the following data | +------------+------------------------------------------------------+ | | The data from from the file | +------------+------------------------------------------------------+ or: +------------+------------------------------------------------------+ | !E | There was an error reading the file | +------------+------------------------------------------------------+ Change Directory ---------------- The format of the message from the client is: +------------+------------------------------------------------------+ | CD | Change directory command | +------------+------------------------------------------------------+ | | Length of pathname | +------------+------------------------------------------------------+ | | The pathname | +------------+------------------------------------------------------+ The server responds with either: +------------+------------------------------------------------------+ | OK | The command completed OK | +------------+------------------------------------------------------+ or: +------------+------------------------------------------------------+ | !E | There was an error changing to the directory | +------------+------------------------------------------------------+ Create Directory ---------------- The format of the message from the client is: +------------+------------------------------------------------------+ | MD | Create directory command | +------------+------------------------------------------------------+ | | Length of pathname | +------------+------------------------------------------------------+ | | The pathname | +------------+------------------------------------------------------+ The server responds with either: +------------+------------------------------------------------------+ | OK | The command completed OK | +------------+------------------------------------------------------+ or: +------------+------------------------------------------------------+ | !E | There was an error creating the directory | +------------+------------------------------------------------------+ List Files ---------- The format of the message from the client is: +------------+------------------------------------------------------+ | LS | List files command | +------------+------------------------------------------------------+ The server responds with either: +------------+------------------------------------------------------+ | OK | The command completed OK | +------------+------------------------------------------------------+ | | The number of filenames | +------------+------------------------------------------------------+ | | Length of filename 1 | +------------+------------------------------------------------------+ | | Filename 1 | +------------+------------------------------------------------------+ ... above 2 fields repeated ... +------------+------------------------------------------------------+ | | Length of filename N | +------------+------------------------------------------------------+ | | Filename N | +------------+------------------------------------------------------+ or: +------------+------------------------------------------------------+ | !E | There was an error reading the directory | +------------+------------------------------------------------------+