Projet_JAVA_P2P_STRI2A/doc/protocol.md

13 lines
810 B
Markdown
Raw Normal View History

2020-01-12 22:04:15 +01:00
# P2P-JAVA-PROJECT version 1 (Protocol for step 1)
All messages begins with `P2P-JAVA-PROJECT VERSION 1.0\n` (this version of the protocol).
## Client messages
- `LIST\n`: ask the server to list files from server root directory
- `DOWNLOAD\n<FILENAME>\n`: ask the server to download file <FILENAME> from server root directory. Only one filename is allowed per request.
## Server responses
- The response to `LIST` request is in the format `LIST\n<FILENAME 1>\n<FILENAME 2>\n[…]<LAST FILENAME>\n\n`
- The response to `DOWNLOAD` request is `LOAD <FILESIZE (BYTES)>\n<CONTENT OF FILE>` or `NOT FOUND\n` if the file doesn't exists.
- The server send a `PROTOCOL ERROR\n` message if it doesn't understands what the client sent.
2020-01-12 22:20:52 +01:00
- The server send a `INTERNAL ERROR\n` message if it encounters an internal error.