Explorar el Código

Changing how put and get works

anon hace 4 años
padre
commit
fc5a872a22
Se han modificado 1 ficheros con 9 adiciones y 14 borrados
  1. 9 14
      Client-Server Protocol.md

+ 9 - 14
Client-Server Protocol.md

@@ -109,21 +109,14 @@ Client:
 {
 	"command": "put",
 	"data": string,
-	"finish": bool
+	"remaining": int,
+	"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.
-In the last request the client has to set the `finish` flag to `true`.
-<br>
-After the last part was received the server answers with `finish` set to `true`.
-<br>
-Server:
-```
-{
-	"command": "put",
-	"finish": bool
-}
-```
+`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.
+
 
 ### 2.4 Get command
 Client:
@@ -148,11 +141,13 @@ Server:
 {
 	"command": "get",
 	"data": string,
-	"finish": bool
+	"remaining": int,
+	"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.
-In the last request the server has to set the `finish` flag to `true`.
+`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.
 
 
 ### TODO