Difference between revisions of "Server List Ping"
Barneygale (talk | contribs) (Created page with "Minecraft supports querying the MOTD, player count, max players and server version via the usual port. Unlike Query, the server list ping interface is always enabled. == ...") |
Barneygale (talk | contribs) |
||
Line 9: | Line 9: | ||
The server responds with a [[Protocol#Disconnect.2FKick_.280xFF.29|0xFF kick]] packet. The packet begins with a single byte identifier <code>ff</code>, then a two-byte big endian short giving the length of the proceeding string in characters. You can actually ignore the length because the server closes the connection after the response is sent. | The server responds with a [[Protocol#Disconnect.2FKick_.280xFF.29|0xFF kick]] packet. The packet begins with a single byte identifier <code>ff</code>, then a two-byte big endian short giving the length of the proceeding string in characters. You can actually ignore the length because the server closes the connection after the response is sent. | ||
− | After the first 3 bytes, the packet is a big-endian UCS-2 string. It begins with two characters: <code>§1</code>, followed by a null | + | After the first 3 bytes, the packet is a big-endian UCS-2 string. It begins with two characters: <code>§1</code>, followed by a null character. On the wire these look like <code>00 a7 00 31 00 00</code>. |
The remainder is null character (that is <code>00 00</code>) delimited fields: | The remainder is null character (that is <code>00 00</code>) delimited fields: |
Revision as of 10:34, 26 October 2012
Minecraft supports querying the MOTD, player count, max players and server version via the usual port. Unlike Query, the server list ping interface is always enabled.
Client -> Server
The client initiates a TCP connection to the minecraft server on the standard port. Instead of doing auth and logging in (as detailed in Protocol Encryption), it sends the two byte sequence FE 01
. This is a 0xFE server list ping packet.
Server -> Client
The server responds with a 0xFF kick packet. The packet begins with a single byte identifier ff
, then a two-byte big endian short giving the length of the proceeding string in characters. You can actually ignore the length because the server closes the connection after the response is sent.
After the first 3 bytes, the packet is a big-endian UCS-2 string. It begins with two characters: §1
, followed by a null character. On the wire these look like 00 a7 00 31 00 00
.
The remainder is null character (that is 00 00
) delimited fields:
- Protocol version (e.g.
47
) - Minecraft server version (e.g.
1.4.1
) - Message of the day (e.g.
A Minecraft Server
) - Current player count
- Max players
The entire packet looks something like this:
<---> first character 0000000: ff00 2300 a700 3100 0000 3400 3700 0000 ....§.1...4.7... 0000010: 3100 2e00 3400 2e00 3200 0000 4100 2000 1...4...2...A. . 0000020: 4d00 6900 6e00 6500 6300 7200 6100 6600 M.i.n.e.c.r.a.f. 0000030: 7400 2000 5300 6500 7200 7600 6500 7200 t. .S.e.r.v.e.r. 0000040: 0000 3000 0000 3200 30 ..0...2.0
Sample code
- [1] - python