Server List Ping:zh-cn

Jump to navigation Jump to search

Server List Ping (SLP) 是 Minecraft 服务器提供的接口,通过正常游戏端口查询MOTD,玩家数量,最大玩家数和服务器版本。SLP是Protocol的一部分,但是SLP也可以被禁用。SLP因被官方客户端用于显示多人服务器列表而得名。SLP过程在1.7中以非向后兼容的方式进行了更新,但现在的服务器仍然同时支持新版本老版本的处理方式.

目前使用的 (1.7+)

现在的版本使用正常的 客户端-服务端 protocol. 通用数据包格式请见这篇文章



数据包 ID 字段名称 字段类型 注释
0x00 Protocol版本 VarInt 详见Protocol版本号。客户端计划用于连接到服务器的版本(对ping来说不重要)。如果客户端正在ping以确定正在使用的版本,则应按照标准,把这个值设置为-1

Warning.png 如果发送了无效的(不存在的)版本号 可能 导致某些服务端在这个数据包后关闭连接
Warning.png 请见Protocol version numbers查询有效的版本号

服务器地址 字符串 主机名或IP,例如localhost和127.0.0.1,也就是用来连接的地址。官方服务器并不使用。注意SRV记录是一个完整的重定向,例如,如果_minecraft._tcp.example.com指向, 那么连接到example.com的用户另外还会把mc.example.org作为服务器地址。(翻译者:?不确定)
服务器端口 Unsigned Short 默认是25565。官方服务器并不使用。
下一阶段 VarInt 应该是1为状态阶段,但也可能是2为登录阶段

Status Request

The client follows up with a Status Request packet. This packet has no fields. The client is also able to skip this part entirely and send a Ping Request instead.

Packet ID Field Name Field Type Notes
0x00 no fields

Status Response

The server should respond with a Status Response packet. Note that Notchian servers will for unknown reasons wait to receive the following Ping Request packet for 30 seconds before timing out and sending Response.

Packet ID Field Name Field Type Notes
0x00 JSON Response String See below; as with all strings this is prefixed by its length as a VarInt(2-byte max)

The JSON Response field is a JSON object which has the following format:

    "version": {
        "name": "1.19.4",
        "protocol": 762
    "players": {
        "max": 100,
        "online": 5,
        "sample": [
                "name": "thinkofdeath",
                "id": "4566e69f-c907-48ee-8d71-d7ba5aa00d20"
    "description": {
        "text": "Hello world"
    "favicon": "data:image/png;base64,<data>",
    "enforcesSecureChat": true,
    "previewsChat": true

An id of a sample needs to be a valid UUID format, else the connection will abort.

The description field is a text component. Note that the Notchian server has no way of providing actual text component data; instead section sign-based codes are embedded within the text of the object. However, third-party servers such as Spigot and Paper will return full components, so make sure you can handle both.

The favicon field is optional. The sample field may be missing if the server has no online players.

The favicon should be a PNG image that is Base64 encoded (without newlines: \n, new lines no longer work since 1.13) and prepended with data:image/png;base64,. It should also be noted that the source image must be exactly 64x64 pixels, otherwise the Notchian client will not render the image.

After receiving the Response packet, the client may send the next packet to help calculate the server's latency, or if it is only interested in the above information it can disconnect here.

If the client does not receive a properly formatted response, then it will instead attempt a legacy ping.

Ping Request

If the process is continued, the client will now send a Ping Request packet containing some payload which is not important.

Packet ID Field Name Field Type Notes
0x01 Payload Long May be any number. Notchian clients use a system-dependent time value which is counted in milliseconds.

Pong Response

The server will respond with the Pong Response packet and then close the connection.

Packet ID Field Name Field Type Notes
0x01 Payload Long Should be the same as sent by the client

Ping via LAN (Open to LAN in Singleplayer)

In Singleplayer there is a function called "Open to LAN". Minecraft (in the serverlist) binds a UDP port and listens for connections to (Yes, that is the actual IP, no matter in what network you are or what your local IP Address is). If you click on "Open to LAN" Minecraft sends a packet every 1.5 seconds to the address: [MOTD]{motd}[/MOTD][AD]{port}[/AD]. Minecraft seems to check for the following Strings: [MOTD], [/MOTD], [AD], [/AD]. Anything you write outside of each of the tags will be ignored. Color codes may be used in the MOTD. Between [AD] and [/AD] is the servers port. If it is not numeric, 25565 will be used. If it is out of range, an error is being displayed when trying to connect. The IP Address is the same as the senders one. The string is encoded with UTF-8.

To implement it server side, just send a packet with the text (payload) to If you are client side, bind a UDP socket and listen for connections. You can use a MulticastSocket for that.



This uses a protocol which is compatible with the client-server protocol as it was before the Netty rewrite. Modern servers recognize this protocol by the starting byte of fe instead of the usual 00.

Client to server

The client initiates a TCP connection to the server on the standard port. Instead of doing auth and logging in (as detailed in Protocol and Protocol Encryption), it sends the following data, expressed in hexadecimal:

  1. FE — packet identifier for a server list ping
  2. 01 — server list ping's payload (always 1)
  3. FA — packet identifier for a plugin message
  4. 00 0B — length of following string, in characters, as a short (always 11)
  5. 00 4D 00 43 00 7C 00 50 00 69 00 6E 00 67 00 48 00 6F 00 73 00 74 — the string MC|PingHost encoded as a UTF-16BE string
  6. XX XX — length of the rest of the data, as a short. Compute as 7 + len(hostname), where len(hostname) is the number of bytes in the UTF-16BE encoded hostname.
  7. XXprotocol version, e.g. 4a for the last version (74)
  8. XX XX — length of following string, in characters, as a short
  9. ... — hostname the client is connecting to, encoded as a UTF-16BE string
  10. XX XX XX XX — port the client is connecting to, as an int.

All data types are big-endian.

Example 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.

Note: All notchian servers only cares about the first 3 bytes. After reading FE 01 FA, the response will be sent to the client. For backward compatibility, you could only send these 3 bytes and all legacy servers(<=1.6) will respond correspondingly.

Server to 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 following 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 UTF-16BE 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:

  1. Protocol version (e.g. 47)
  2. Minecraft server version (e.g. 1.4.2)
  3. Message of the day (e.g. A Minecraft Server)
  4. Current player count
  5. 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

Note: When using this protocol with servers on version 1.7.x and above, the protocol version (first field) in the response will always be 127 which is not a real protocol number, so older clients will always consider this server incompatible.


1.4 to 1.5

Prior to the Minecraft 1.6, the client to server operation is much simpler, and only sends FE 01, with none of the following data.


Beta 1.8 to 1.3

Prior to Minecraft 1.4, the client only sends FE.

The server should respond with a kick packet:

Field Name Field Type Notes
Packet Id Byte The kick packet id: 0xFF
Packet Length Short The length of the following string in characters (NOT BYTES). Max is 256.
MOTD A UTF-16BE encoded string From here on out, all fields should be separated with §, in the same string.
Online Players The count of players currently on the server.
Max Players The maximum amount of players that the server is willing to accept.

The entire packet looks something like this on wire:

                <---> 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