-
-
Notifications
You must be signed in to change notification settings - Fork 38
Server info response
version: 1.16.3
protocol: 753
This is an example of captured data (after the client info request):
b'\xf8W\x00\xf5W{"description":{"text":"\xc2\xa7fServer status:\xc2\xa7r\\n \xc2\xa7b\xc2\xa7l\xc2\xa7oHIBERNATING"},"players":{"max":20,"online":0},"version":{"name":"1.16.2","protocol":751},"favicon":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAgK0lEQVR42uV7CViV55l2kqbpdJqmmWliXGJEURDZOez7DgcO+77KKgKKgvsSg1uioHFhURDTdNJOO1unaWI2474 ... }'
There are 2 main parts in this message:
- header (explained below)
- json data (self explanatory)
TXT (for very short text, less than 255 of length):
message = b'{ciao}'
header = \x08\x00\x06
fullmex = \x08\x00\x06{ciao}
6 equals the length of {ciao}
and 8 equals the length of \x00\x06{ciao}
this method is implemented for the client loading screen message when the server is "offline" or "starting".
INFO (works also for TXT):
┌----------------- | ----header---- | -----------------┐ | data | |
---|---|---|---|---|
scheme: | sub-header1 | sub-header2 | sub-header3 | message |
bytes used: | 2 | 1 | 2 | 0 ... 16381 |
value range: | 131 0 - 255 127 | 0 | 128 0 - 252 127 | --- |
The sub-header is a number composed of 2 digits in base-128 (firstByte is least significant byte)
Sub-header 2-byte value represents the lenght of the following data
The firstByte value can range between 128 and 255 while secondByte can range between 0 and 127
Being a number of 2 digits with 128 possible values each, the maximum length of data is 16381 (16384 - 3 (length of sub-header 1 and 2))
┌-sub-header1/3 | -------------┐ | ||
---|---|---|---|
scheme: | firstByte | secondByte | data |
value range: | 128-255 | 0-127 | --- |
after the server has answered with the server info the client sends a packet similar to this:
\t\x01\x00\x00\x00\x00\x00\x06t\xfa
(the last 3 bytes are random)
The server needs to take the whole packet and send it again to the client (the client will calculate the time of flight and display it)
cases in which client packet terminates with \x01
or \x01\x01\x00
(look here: client info request):
- the server needs to read an additional packet (
\x01\x00
) before receiving the ping request - the server needs to read the following packet to get the ping request packet)
example 1:
client: \x10\x00\xc2\x04\t127.0.0.1c\xdd\x01
server: sends info
client: \x01\x00
client: ping request
server: ping response
example 2:
client: \x10\x00\xc2\x04\t127.0.0.1c\xdd\x01\x01\x00
server: sends info
client: ping request
server ping response
issue: link
Implemented in commit: 8ededa2 (version 6.9)
Update header calculation in commit: 9c680be (version 2.0.0)