The protocol is decribed by the sequence of operation
codes and the meaning of the argument:
- First message: from server to client: operation code
HELLO (0); argument is an arbitary HELLO-BANNER.
- Second message: from client the server - the request. Either:
- A READ-REQUEST (1); argument
is the file name for the server to read and send to client.
- A WRITE-REQUEST (2): argument
is the file name for the server to write the data
which the client will send.
- Third message: from server to client: the response. Either:
- An ACKNOWLEDGEMENT (4): argument is arbitrary.
- An ERROR (5): arguement is an explanation, for instance "File Not Found"
- If ACKNOWLEDGEMENT, then client and server exchange data bytes.
If ERROR both close their sockets. The client exits; the server waits
for the next connection.
S->C: [0][10][jtfp ready]
C->S: [1][8][test.txt]
S->C: [4][2][OK]
S->C: ... data bytes ...