- one byte opcode of which is one of the following ASCII characters:
- f = regular file
- d = directory
- o = other type of file
- two-byte integer in two's complement and network byte order representing the length of the
filename of the file / folder in the directory
- The sequence of ASCII characters representing the filename of the file / folder
Command - get
1. Client sends get request
- Client sends one byte opcode of ASCII character 'C' followed by
- two-byte integer in two's complement and network byte order representing the length of the
filename of the file to be retrieved from the server
- The sequence of characters representing the filename
2. Server response
- Server sends one byte opcode of ASCII character 'C' followed by
- one byte opcode which is one of the following ASCII characters:
- 0 = OK to send file
- 1 = file not found
- 2 = permission denied
- 3 = other reason for failure
- if 0 then server will send four-byte integer in two's complement and network byte order which
represents the length of the file
- The sequence of N bytes which is the content of the file
Command - put
1. Client sends put request
- Client sends one byte opcode of ASCII character 'D' followed by
- two-byte integer in two's complement and network byte order representing the length of the
filename of the file to be put on the server followed by
- The sequence of characters representing the filename
2. Server response
- Server sends one byte opcode of the ASCII character 'D' followed by
- one byte acknowledgement code which is one of the following ASCII characters:
- 0 = ready to receive the named file
- 1 = cannot accept file as filename clashes
- 2 = cannot accept file as server cannot create the named file
- 3 = cannot accept file due to other reason
10

11

“lpwd” test output
“cd” test output
“lcd” test output
“dir” test output
“ldir” test output
12

“put” test output
13

14

“get” test output
“quit” test output
15

Source code
Under myftp folder
myftp.c
/*
* File: myftp.c
* Author: Aung Myin 32812965 & Pan Xu 32813676
*
* Description: This is the main implementation file for the myftp client
* program.
