You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Projet_JAVA_P2P_STRI2A/doc/protocol.md

12 lines
727 B
Markdown

# 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.