Skip to content

Commit bfd5615

Browse files
committed
protocol: Improve connection stage docs
1 parent 99fd6b0 commit bfd5615

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

docs/protocol/specification.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,16 @@ As noted earlier, Skyhash is a client/server protocol built on top of TCP, that
1313
- **Client handshake**: The client sends a handshake packet
1414
- The handshake contains all necessary information to successfully establish a connection
1515
- The structure of the client handshake depends on the authentication plugin in use (since authentication data has to be exchanged before the connection can be established)
16-
- For the `pwd` plugin the client handshake looks like this (split into lines for convenience):
16+
- For the `pwd` plugin the client handshake looks like this:
1717
```
18-
H0
19-
<protocol compatibility code>
20-
000
21-
<username length>\n<password length>\n<username><password>
18+
H0<protocol compatibility code>000<username length>\n<password length>\n<username><password>
2219
```
23-
> For the protocol compatibility code, [see the version matrix](/protocol/#version-matrix)
20+
- For the protocol compatibility code, [see the version matrix](/protocol/#version-matrix)
21+
- Please note that `0` means integer value `0` (`0x00`) and NOT the ASCII digit 0
22+
- Both the `<username length>` and `<password length>` are the respective lengths encoded as ASCII strings
2423
- **Server handshake**:
25-
- **Accepted:** If the server accepts the handshake information then it will respond with: `H000`
26-
- **Rejected**: If the server rejects the handshake information then it will respond with `H01<8-bit error code>`. You can find out what happened using [the error code index](errors)
24+
- **Accepted:** If the server accepts the handshake information then it will respond with: `H000` (all the numeric values are integers and NOT ASCII digits)
25+
- **Rejected**: If the server rejects the handshake information then it will respond with `H01<8-bit error code>` (all the numeric values are integers and NOT ASCII digits). You can find out what happened using [the error code index](errors)
2726
- Data exchange stage: This is where the client and server send and receive data. A client and server will spend the majority of their time in this stage.
2827
- Termination stage: Once the connection is no longer needed, the client (or in exceptional cases, the server) will close the connection using a simple TCP FIN.
2928

0 commit comments

Comments
 (0)