Difference between revisions of "Server List Ping"
Barneygale (talk | contribs) (Protocol version is 74 for 1.6.2) |
(Make it easier to understand) |
||
Line 5: | Line 5: | ||
=== Client -> Server === | === 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 | + | 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 a 0xFE packet to the server |
− | + | {| class="wikitable" | |
− | + | |- | |
− | + | | Packet ID | |
− | + | | Field Name | |
− | + | | Field Type | |
− | + | | Example | |
− | + | | Notes | |
− | + | |- | |
− | + | | rowspan="1" | 0xFE | |
− | + | | Magic | |
+ | | byte | ||
+ | | <code>1</code> | ||
+ | | always <code>1</code> | ||
+ | |- | ||
+ | | Total Size: | ||
+ | | colspan="4" | 2 bytes | ||
+ | |} | ||
− | + | Followed by a [http://wiki.vg/Protocol#Plugin_Message_.280xFA.29 Plugin Message Packet] with the Channel set to "MC|PingHost" and the following Payload (which can be parsed the same way as a packets get parsed, but without a packet id) | |
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | Field Name | ||
+ | | Field Type | ||
+ | | Example | ||
+ | | Notes | ||
+ | |- | ||
+ | | Protocol Version | ||
+ | | byte | ||
+ | | <code>73</code> | ||
+ | | | ||
+ | |- | ||
+ | | Hostname | ||
+ | | string | ||
+ | | <code>127.0.0.1</code> | ||
+ | | | ||
+ | |- | ||
+ | | Port | ||
+ | | int | ||
+ | | <code>25565</code> | ||
+ | | | ||
+ | |- | ||
+ | | Total Size: | ||
+ | | colspan="3" | 7 bytes + length of string * 2 | ||
+ | |} | ||
Packet dump: | Packet dump: | ||
Line 26: | Line 59: | ||
0000020: 006c 006f 0063 0061 006c 0068 006f 0073 .l.o.c.a.l.h.o.s | 0000020: 006c 006f 0063 0061 006c 0068 006f 0073 .l.o.c.a.l.h.o.s | ||
0000030: 0074 0000 63dd .t..c. | 0000030: 0074 0000 63dd .t..c. | ||
+ | |||
+ | The Minecraft Server will answer with a [http://wiki.vg/Protocol#Disconnect.2FKick_.280xFF.29 Disconnect Packet] with the Following Content: | ||
+ | |||
+ | <code>§1\0{0}\0{1}\0{2}\0{3}\0{4}</code> | ||
+ | Filled with the following data: | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | Protocol Version | ||
+ | |- | ||
+ | | Version String | ||
+ | |- | ||
+ | | Message Of The Day | ||
+ | |- | ||
+ | | Used Slots | ||
+ | |- | ||
+ | | Max Slots | ||
+ | |} | ||
+ | |||
+ | Example: | ||
+ | <code>§1\051\01.4.7\0A Minecraft Server\00\020</code> | ||
=== Server -> Client === | === Server -> Client === |
Revision as of 21:24, 10 July 2013
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.
1.6
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 a 0xFE packet to the server
Packet ID | Field Name | Field Type | Example | Notes |
0xFE | Magic | byte | 1
|
always 1
|
Total Size: | 2 bytes |
Followed by a Plugin Message Packet with the Channel set to "MC|PingHost" and the following Payload (which can be parsed the same way as a packets get parsed, but without a packet id)
Field Name | Field Type | Example | Notes |
Protocol Version | byte | 73
|
|
Hostname | string | 127.0.0.1
|
|
Port | int | 25565
|
|
Total Size: | 7 bytes + length of string * 2 |
Packet dump:
0000000: fe01 fa00 0b00 4d00 4300 7c00 5000 6900 ......M.C.|.P.i. 0000010: 6e00 6700 4800 6f00 7300 7400 1949 0009 n.g.H.o.s.t..I.. 0000020: 006c 006f 0063 0061 006c 0068 006f 0073 .l.o.c.a.l.h.o.s 0000030: 0074 0000 63dd .t..c.
The Minecraft Server will answer with a Disconnect Packet with the Following Content:
§1\0{0}\0{1}\0{2}\0{3}\0{4}
Filled with the following data:
Protocol Version |
Version String |
Message Of The Day |
Used Slots |
Max Slots |
Example:
§1\051\01.4.7\0A Minecraft Server\00\020
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.2
) - 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
1.4 - 1.5
Prior to the Minecraft 1.6, the client -> server operation is much simpler, and only sends FE 01
, with none of the following data beginning FA ...
Beta 1.8 - 1.3
Prior to Minecraft 1.4, the client only sends FE
.
Additionally, the response from the server only contains 3 fields delimited by §
:
- 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 1700 4100 2000 4d00 6900 6e00 6500 ....A. .M.i.n.e. 0000010: 6300 7200 6100 6600 7400 2000 5300 6500 c.r.a.f.t. .S.e. 0000020: 7200 7600 6500 7200 a700 3000 a700 3100 r.v.e.r.§.0.§.1. 0000030: 30 0