Browse Source

Changed how files are sent and received

anon 5 years ago
parent
commit
fdfd7895ab
1 changed files with 22 additions and 4 deletions
  1. 22 4
      Client-Server Protocol.md

+ 22 - 4
Client-Server Protocol.md

@@ -113,10 +113,19 @@ Client:
 	"cancel": bool
 }
 ```
-`data` is a base64 string and contains a piece of the file. The client will loop this until the file is completely sent.
+`data` is a base64 string and contains a piece of the file. The client will loop this until the file is completely sent and the server has to send and received message for every chunk.
 `remaining` is a counter how many chunks will follow and the transfer is over after it hits `0`.
 If `cancel` is `true` the file transfer will be canceled.
-
+<br /><br />
+Server:
+```
+{
+	"command": "put",
+	"recieved": int,
+	"cancel": bool
+}
+```
+If `cancel` is `false` then cancel the upload of the file.
 
 ### 2.4 Get command
 Client:
@@ -145,10 +154,19 @@ Server:
 	"cancel": bool
 }
 ```
-`data` is a base64 string and contains a piece of the file. The server will loop this until the file is completely sent.
+`data` is a base64 string and contains a piece of the file. The server will loop this until the file is completely sent and the client has to send a received message for every chunk.
 `remaining` is a counter how many chunks will follow and the transfer is over after it hits `0`.
 If `cancel` is `true` the file transfer will be canceled.
-
+<br /><br />
+Client:
+```
+{
+	"command": "get",
+	"recieved": int,
+	"cancel": bool
+}
+```
+If `cancel` is `false` then cancel the download of the file.
 
 ### TODO