<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wikivg.spaghett.dev/index.php?action=history&amp;feed=atom&amp;title=Server_List_Ping%3Azh-cn</id>
	<title>Server List Ping:zh-cn - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wikivg.spaghett.dev/index.php?action=history&amp;feed=atom&amp;title=Server_List_Ping%3Azh-cn"/>
	<link rel="alternate" type="text/html" href="https://wikivg.spaghett.dev/index.php?title=Server_List_Ping:zh-cn&amp;action=history"/>
	<updated>2026-04-06T05:52:07Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://wikivg.spaghett.dev/index.php?title=Server_List_Ping:zh-cn&amp;diff=11699&amp;oldid=prev</id>
		<title>imported&gt;Jrojro: 修改错误</title>
		<link rel="alternate" type="text/html" href="https://wikivg.spaghett.dev/index.php?title=Server_List_Ping:zh-cn&amp;diff=11699&amp;oldid=prev"/>
		<updated>2024-02-19T14:55:04Z</updated>

		<summary type="html">&lt;p&gt;修改错误&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 14:55, 19 February 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l24&quot;&gt;Line 24:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 24:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  | 服务器地址&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  | 服务器地址&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  | 字符串&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  | 字符串&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  | 主机名或IP，例如localhost和127.0.0.1，也就是用来连接的地址。官方服务器并不使用。注意SRV记录是一个完整的重定向,例如，如果_minecraft._tcp.example.com指向mc.example.org, 那么连接到example.&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;comd的用户另外还会把mc&lt;/del&gt;.example.org作为服务器地址。(翻译者：?不确定)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  | 主机名或IP，例如localhost和127.0.0.1，也就是用来连接的地址。官方服务器并不使用。注意SRV记录是一个完整的重定向,例如，如果_minecraft._tcp.example.com指向mc.example.org, 那么连接到example.&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;com的用户另外还会把mc&lt;/ins&gt;.example.org作为服务器地址。(翻译者：?不确定)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  |-&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  |-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  | 服务器端口&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  | 服务器端口&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;Jrojro</name></author>
	</entry>
	<entry>
		<id>https://wikivg.spaghett.dev/index.php?title=Server_List_Ping:zh-cn&amp;diff=11698&amp;oldid=prev</id>
		<title>imported&gt;Jrojro: 总览和握手阶段翻译</title>
		<link rel="alternate" type="text/html" href="https://wikivg.spaghett.dev/index.php?title=Server_List_Ping:zh-cn&amp;diff=11698&amp;oldid=prev"/>
		<updated>2024-01-27T06:06:37Z</updated>

		<summary type="html">&lt;p&gt;总览和握手阶段翻译&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Server List Ping&amp;#039;&amp;#039;&amp;#039; (&amp;#039;&amp;#039;&amp;#039;SLP&amp;#039;&amp;#039;&amp;#039;) 是 Minecraft 服务器提供的接口，通过正常游戏端口查询MOTD,玩家数量,最大玩家数和服务器版本。SLP是[[Protocol]]的一部分,但是SLP也可以被禁用。SLP因被官方客户端用于显示多人服务器列表而得名。SLP过程在{{Minecraft Wiki|1.7}}中以非向后兼容的方式进行了更新，但现在的服务器仍然同时支持[[#Current|新版本]]与[[#1.6|老版本]]的处理方式.&lt;br /&gt;
&lt;br /&gt;
== 目前使用的 (1.7+) ==&lt;br /&gt;
&lt;br /&gt;
现在的版本使用正常的 客户端-服务端 [[protocol]]. 通用数据包格式请见这篇文章&lt;br /&gt;
&lt;br /&gt;
=== 握手阶段 ===&lt;br /&gt;
&lt;br /&gt;
首先，客户端发送一个[[Protocol#Handshake|握手]]数据包同时把它自身的状态值设置为1。&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! 数据包 ID&lt;br /&gt;
 ! 字段名称&lt;br /&gt;
 ! 字段类型&lt;br /&gt;
 ! 注释&lt;br /&gt;
 |-&lt;br /&gt;
 |rowspan=&amp;quot;4&amp;quot;| 0x00&lt;br /&gt;
 | Protocol版本&lt;br /&gt;
 | VarInt&lt;br /&gt;
 | 详见[[protocol version numbers|Protocol版本号]]。客户端计划用于连接到服务器的版本(对ping来说不重要)。如果客户端正在ping以确定正在使用的版本，则应按照标准，把这个值设置为&amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt;。&lt;br /&gt;
{{Warning|如果发送了无效的(不存在的)版本号 &amp;lt;i&amp;gt;可能&amp;lt;/i&amp;gt; 导致某些服务端在这个数据包后关闭连接}}&amp;lt;br/&amp;gt;&lt;br /&gt;
{{Warning|请见[[Protocol version numbers]]查询有效的版本号}}&lt;br /&gt;
 |-&lt;br /&gt;
 | 服务器地址&lt;br /&gt;
 | 字符串&lt;br /&gt;
 | 主机名或IP，例如localhost和127.0.0.1，也就是用来连接的地址。官方服务器并不使用。注意SRV记录是一个完整的重定向,例如，如果_minecraft._tcp.example.com指向mc.example.org, 那么连接到example.comd的用户另外还会把mc.example.org作为服务器地址。(翻译者：?不确定)&lt;br /&gt;
 |-&lt;br /&gt;
 | 服务器端口&lt;br /&gt;
 | Unsigned Short&lt;br /&gt;
 | 默认是25565。官方服务器并不使用。&lt;br /&gt;
 |-&lt;br /&gt;
 | 下一阶段&lt;br /&gt;
 | VarInt&lt;br /&gt;
 | 应该是1为[[Protocol#Status|状态阶段]]，但也可能是2为[[Protocol#Login|登录阶段]]。&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
=== Status Request ===&lt;br /&gt;
&lt;br /&gt;
The client follows up with a [[Protocol#Status Request|Status Request]] packet. This packet has no fields.&lt;br /&gt;
The client is also able to skip this part entirely and send a [[Protocol#Ping Request|Ping Request]] instead.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Packet ID&lt;br /&gt;
 ! Field Name&lt;br /&gt;
 ! Field Type&lt;br /&gt;
 ! Notes&lt;br /&gt;
 |-&lt;br /&gt;
 | 0x00&lt;br /&gt;
 |colspan=&amp;quot;3&amp;quot;| &amp;#039;&amp;#039;no fields&amp;#039;&amp;#039;&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
=== Status Response ===&lt;br /&gt;
&lt;br /&gt;
The server should respond with a [[Protocol#Status Response|Status Response]] packet. Note that Notchian servers will for unknown reasons wait to receive the following [[Protocol#Ping Request|Ping Request]] packet for 30 seconds before timing out and sending Response.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Packet ID&lt;br /&gt;
 ! Field Name&lt;br /&gt;
 ! Field Type&lt;br /&gt;
 ! Notes&lt;br /&gt;
 |-&lt;br /&gt;
 | 0x00&lt;br /&gt;
 | JSON Response&lt;br /&gt;
 | String&lt;br /&gt;
 | See below; as with all strings this is prefixed by its length as a VarInt(2-byte max)&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
The JSON Response field is a [[wikipedia:JSON|JSON]] object which has the following format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;version&amp;quot;: {&lt;br /&gt;
        &amp;quot;name&amp;quot;: &amp;quot;1.19.4&amp;quot;,&lt;br /&gt;
        &amp;quot;protocol&amp;quot;: 762&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;players&amp;quot;: {&lt;br /&gt;
        &amp;quot;max&amp;quot;: 100,&lt;br /&gt;
        &amp;quot;online&amp;quot;: 5,&lt;br /&gt;
        &amp;quot;sample&amp;quot;: [&lt;br /&gt;
            {&lt;br /&gt;
                &amp;quot;name&amp;quot;: &amp;quot;thinkofdeath&amp;quot;,&lt;br /&gt;
                &amp;quot;id&amp;quot;: &amp;quot;4566e69f-c907-48ee-8d71-d7ba5aa00d20&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        ]&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;description&amp;quot;: {&lt;br /&gt;
        &amp;quot;text&amp;quot;: &amp;quot;Hello world&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;favicon&amp;quot;: &amp;quot;data:image/png;base64,&amp;lt;data&amp;gt;&amp;quot;,&lt;br /&gt;
    &amp;quot;enforcesSecureChat&amp;quot;: true,&lt;br /&gt;
    &amp;quot;previewsChat&amp;quot;: true&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An &amp;#039;&amp;#039;id&amp;#039;&amp;#039; of a &amp;#039;&amp;#039;sample&amp;#039;&amp;#039; needs to be a valid UUID format, else the connection will abort.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;description&amp;#039;&amp;#039; field is a [[Text formatting#Text components|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.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;favicon&amp;#039;&amp;#039; field is optional. The &amp;#039;&amp;#039;sample&amp;#039;&amp;#039; field may be missing if the server has no online players.&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;favicon&amp;#039;&amp;#039; should be a [[wikipedia:Portable Network Graphics|PNG]] image that is [[wikipedia:Base64|Base64]] encoded (without newlines: &amp;lt;code&amp;gt;\n&amp;lt;/code&amp;gt;, new lines no longer work since 1.13) and prepended with &amp;lt;code&amp;gt;data:image/png;base64,&amp;lt;/code&amp;gt;. It should also be noted that the source image must be exactly 64x64 pixels, otherwise the Notchian client will not render the image.&lt;br /&gt;
&lt;br /&gt;
After receiving the Response packet, the client may send the next packet to help calculate the server&amp;#039;s latency, or if it is only interested in the above information it can disconnect here.&lt;br /&gt;
&lt;br /&gt;
If the client does not receive a properly formatted response, then it will instead attempt a [[Server_List_Ping#1.6|legacy ping]].&lt;br /&gt;
&lt;br /&gt;
=== Ping Request ===&lt;br /&gt;
&lt;br /&gt;
If the process is continued, the client will now send a [[Protocol#Ping Request|Ping Request]] packet containing some payload which is not important.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Packet ID&lt;br /&gt;
 ! Field Name&lt;br /&gt;
 ! Field Type&lt;br /&gt;
 ! Notes&lt;br /&gt;
 |-&lt;br /&gt;
 | 0x01&lt;br /&gt;
 | Payload&lt;br /&gt;
 | Long&lt;br /&gt;
 | May be any number. Notchian clients use a system-dependent time value which is counted in milliseconds.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
=== Pong Response ===&lt;br /&gt;
&lt;br /&gt;
The server will respond with the [[Protocol#Pong Response|Pong Response]] packet and then close the connection.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Packet ID&lt;br /&gt;
 ! Field Name&lt;br /&gt;
 ! Field Type&lt;br /&gt;
 ! Notes&lt;br /&gt;
 |-&lt;br /&gt;
 | 0x01&lt;br /&gt;
 | Payload&lt;br /&gt;
 | Long&lt;br /&gt;
 | Should be the same as sent by the client&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
=== Ping via LAN (Open to LAN in Singleplayer) ===&lt;br /&gt;
&lt;br /&gt;
In Singleplayer there is a function called &amp;quot;Open to LAN&amp;quot;. Minecraft (in the serverlist) binds a UDP port and listens for connections to &amp;lt;code&amp;gt;224.0.2.60:4445&amp;lt;/code&amp;gt; (Yes, that is the actual IP, no matter in what network you are or what your local IP Address is). If you click on &amp;quot;Open to LAN&amp;quot; Minecraft sends a packet every 1.5 seconds to the address: &amp;lt;code&amp;gt;[MOTD]{motd}[/MOTD][AD]{port}[/AD]&amp;lt;/code&amp;gt;. Minecraft seems to check for the following Strings: &amp;lt;code&amp;gt;[MOTD]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;[/MOTD]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;[AD]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;[/AD]&amp;lt;/code&amp;gt;. Anything you write outside of each of the tags will be ignored. Color codes may be used in the MOTD. Between &amp;lt;code&amp;gt;[AD]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[/AD]&amp;lt;/code&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
To implement it server side, just send a packet with the text (payload) to &amp;lt;code&amp;gt;224.0.2.60:4445&amp;lt;/code&amp;gt;. If you are client side, bind a UDP socket and listen for connections. You can use a &amp;lt;code&amp;gt;MulticastSocket&amp;lt;/code&amp;gt; for that.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
* [https://gist.github.com/csh/2480d14fbbb33b4bbae3 C#]&lt;br /&gt;
* [https://gist.github.com/zh32/7190955 Java]&lt;br /&gt;
* [https://gist.github.com/1209061 Python]&lt;br /&gt;
* [https://github.com/Sch8ill/MCClient-lib MCClient-lib (Python3)]&lt;br /&gt;
* [https://gist.github.com/ewized/97814f57ac85af7128bf Python3]&lt;br /&gt;
* [https://github.com/xPaw/PHP-Minecraft-Query PHP]&lt;br /&gt;
* [https://gitlab.bixilon.de/bixilon/minosoft/-/blob/43d8988ef94b6487e4da0218d87cf66ccf14a1ea/src/main/java/de/bixilon/minosoft/protocol/protocol/LANServerListener.java LAN Server Listener (Java)]&lt;br /&gt;
* [https://gitlab.bixilon.de/bixilon/minosoft/-/blob/master/src/main/java/de/bixilon/minosoft/protocol/protocol/LANServerListener.kt LAN Server Listener (Kotlin)]&lt;br /&gt;
* [https://github.com/stackotter/delta-client/blob/main/Sources/Core/Sources/Network/LANServerEnumerator.swift Swift]&lt;br /&gt;
* [https://github.com/dreamscached/minequery Go]&lt;br /&gt;
* [https://github.com/PauldeKoning/minecraft-server-handshake Node.js]&lt;br /&gt;
* [https://github.com/LhAlant/MinecraftSLP/ C]&lt;br /&gt;
* [https://github.com/mcstatus-io/mcutil/ Go]&lt;br /&gt;
&lt;br /&gt;
== 1.6 ==&lt;br /&gt;
&lt;br /&gt;
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 &amp;lt;code&amp;gt;fe&amp;lt;/code&amp;gt; instead of the usual &amp;lt;code&amp;gt;00&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Client to server ===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;FE&amp;lt;/code&amp;gt; — packet identifier for a server list ping&lt;br /&gt;
# &amp;lt;code&amp;gt;01&amp;lt;/code&amp;gt; — server list ping&amp;#039;s payload (always 1)&lt;br /&gt;
# &amp;lt;code&amp;gt;FA&amp;lt;/code&amp;gt; — packet identifier for a plugin message&lt;br /&gt;
# &amp;lt;code&amp;gt;00 0B&amp;lt;/code&amp;gt; — length of following string, in characters, as a short (always 11)&lt;br /&gt;
# &amp;lt;code&amp;gt;00 4D 00 43 00 7C 00 50 00 69 00 6E 00 67 00 48 00 6F 00 73 00 74&amp;lt;/code&amp;gt; — the string &amp;lt;code&amp;gt;MC|PingHost&amp;lt;/code&amp;gt; encoded as a [http://en.wikipedia.org/wiki/UTF-16 UTF-16BE] string&lt;br /&gt;
# &amp;lt;code&amp;gt;XX XX&amp;lt;/code&amp;gt; — length of the rest of the data, as a short. Compute as &amp;lt;code&amp;gt;7 + len(hostname)&amp;lt;/code&amp;gt;, where &amp;lt;code&amp;gt;len(hostname)&amp;lt;/code&amp;gt; is the number of bytes in the UTF-16BE encoded hostname.&lt;br /&gt;
# &amp;lt;code&amp;gt;XX&amp;lt;/code&amp;gt; — [[Protocol version numbers#Versions before the Netty rewrite|protocol version]], e.g. &amp;lt;code&amp;gt;4a&amp;lt;/code&amp;gt; for the last version (74)&lt;br /&gt;
# &amp;lt;code&amp;gt;XX XX&amp;lt;/code&amp;gt; — length of following string, in characters, as a short&lt;br /&gt;
# &amp;lt;code&amp;gt;...&amp;lt;/code&amp;gt; — hostname the client is connecting to, encoded as a [http://en.wikipedia.org/wiki/UTF-16 UTF-16BE] string&lt;br /&gt;
# &amp;lt;code&amp;gt;XX XX XX XX&amp;lt;/code&amp;gt; — port the client is connecting to, as an int.&lt;br /&gt;
&lt;br /&gt;
All data types are big-endian.&lt;br /&gt;
&lt;br /&gt;
Example packet dump:&lt;br /&gt;
&lt;br /&gt;
 0000000: fe01 fa00 0b00 4d00 4300 7c00 5000 6900  ......M.C.|.P.i.&lt;br /&gt;
 0000010: 6e00 6700 4800 6f00 7300 7400 1949 0009  n.g.H.o.s.t..I..&lt;br /&gt;
 0000020: 006c 006f 0063 0061 006c 0068 006f 0073  .l.o.c.a.l.h.o.s&lt;br /&gt;
 0000030: 0074 0000 63dd                           .t..c.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note: &amp;#039;&amp;#039;&amp;#039; All notchian servers only cares about the first 3 bytes. After reading &amp;lt;code&amp;gt;FE 01 FA&amp;lt;/code&amp;gt;, the response will be sent to the client. For backward compatibility, you could only send these 3 bytes and all legacy servers(&amp;lt;=1.6) will respond correspondingly.&lt;br /&gt;
&lt;br /&gt;
=== Server to client ===&lt;br /&gt;
&lt;br /&gt;
The server responds with a 0xFF kick packet. The packet begins with a single byte identifier &amp;lt;code&amp;gt;ff&amp;lt;/code&amp;gt;, 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.&lt;br /&gt;
&lt;br /&gt;
After the first 3 bytes, the packet is a UTF-16BE string. It begins with two characters: &amp;lt;code&amp;gt;§1&amp;lt;/code&amp;gt;, followed by a null character. On the wire these look like &amp;lt;code&amp;gt;00 a7 00 31 00 00&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The remainder is null character (that is &amp;lt;code&amp;gt;00 00&amp;lt;/code&amp;gt;) delimited fields:&lt;br /&gt;
&lt;br /&gt;
# Protocol version (e.g. &amp;lt;code&amp;gt;47&amp;lt;/code&amp;gt;)&lt;br /&gt;
# Minecraft server version (e.g. &amp;lt;code&amp;gt;1.4.2&amp;lt;/code&amp;gt;)&lt;br /&gt;
# Message of the day (e.g. &amp;lt;code&amp;gt;A Minecraft Server&amp;lt;/code&amp;gt;)&lt;br /&gt;
# Current player count&lt;br /&gt;
# Max players&lt;br /&gt;
&lt;br /&gt;
The entire packet looks something like this:&lt;br /&gt;
&lt;br /&gt;
                 &amp;lt;---&amp;gt; first character&lt;br /&gt;
 0000000: ff00 2300 a700 3100 0000 3400 3700 0000  ....§.1...4.7...&lt;br /&gt;
 0000010: 3100 2e00 3400 2e00 3200 0000 4100 2000  1...4...2...A. .&lt;br /&gt;
 0000020: 4d00 6900 6e00 6500 6300 7200 6100 6600  M.i.n.e.c.r.a.f.&lt;br /&gt;
 0000030: 7400 2000 5300 6500 7200 7600 6500 7200  t. .S.e.r.v.e.r.&lt;br /&gt;
 0000040: 0000 3000 0000 3200 30                   ..0...2.0&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note: &amp;#039;&amp;#039;&amp;#039; When using this protocol with servers on version 1.7.x and above, the protocol version (first field) in the response will always be &amp;lt;code&amp;gt;127&amp;lt;/code&amp;gt; which is not a real protocol number, so older clients will always consider this server incompatible.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
* [https://gist.github.com/6281388 Ruby]&lt;br /&gt;
* [https://github.com/winny-/mcstat PHP]&lt;br /&gt;
* [https://github.com/dreamscached/minequery Go]&lt;br /&gt;
* [https://github.com/mcstatus-io/mcutil Go]&lt;br /&gt;
&lt;br /&gt;
== 1.4 to 1.5 ==&lt;br /&gt;
&lt;br /&gt;
Prior to the Minecraft 1.6, the client to server operation is much simpler, and only sends &amp;lt;code&amp;gt;FE 01&amp;lt;/code&amp;gt;, with none of the following data.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/Sch8ill/MCClient-lib Python3 (MCClient-lib)]&lt;br /&gt;
* [https://gist.github.com/5795159 PHP]&lt;br /&gt;
* [https://gist.github.com/4574114 Java]&lt;br /&gt;
* [https://gist.github.com/6223787 C#]&lt;br /&gt;
* [https://github.com/dreamscached/minequery Go]&lt;br /&gt;
* [https://github.com/mcstatus-io/mcutil Go]&lt;br /&gt;
&lt;br /&gt;
== Beta 1.8 to 1.3 ==&lt;br /&gt;
&lt;br /&gt;
Prior to Minecraft 1.4, the client only sends &amp;lt;code&amp;gt;FE&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The server should respond with a kick packet:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Field Name&lt;br /&gt;
 ! Field Type&lt;br /&gt;
 ! Notes&lt;br /&gt;
 |-&lt;br /&gt;
 | Packet Id&lt;br /&gt;
 | Byte&lt;br /&gt;
 | The kick packet id: &amp;lt;code&amp;gt;0xFF&amp;lt;/code&amp;gt;&lt;br /&gt;
 |-&lt;br /&gt;
 | Packet Length&lt;br /&gt;
 | Short&lt;br /&gt;
 | The length of the following string in characters (NOT BYTES). Max is 256.&lt;br /&gt;
 |-&lt;br /&gt;
 | MOTD&lt;br /&gt;
 |rowspan=&amp;quot;3&amp;quot;| A [http://en.wikipedia.org/wiki/UTF-16 UTF-16BE] encoded string&lt;br /&gt;
 | From here on out, all fields should be separated with &amp;lt;code&amp;gt;§&amp;lt;/code&amp;gt;, in the same string.&lt;br /&gt;
 |-&lt;br /&gt;
 | Online Players&lt;br /&gt;
 | The count of players currently on the server.&lt;br /&gt;
 |-&lt;br /&gt;
 | Max Players&lt;br /&gt;
 | The maximum amount of players that the server is willing to accept.&lt;br /&gt;
 |}&lt;br /&gt;
&lt;br /&gt;
The entire packet looks something like this on wire:&lt;br /&gt;
&lt;br /&gt;
                 &amp;lt;---&amp;gt; first character&lt;br /&gt;
 0000000: ff00 1700 4100 2000 4d00 6900 6e00 6500  ....A. .M.i.n.e.&lt;br /&gt;
 0000010: 6300 7200 6100 6600 7400 2000 5300 6500  c.r.a.f.t. .S.e.&lt;br /&gt;
 0000020: 7200 7600 6500 7200 a700 3000 a700 3100  r.v.e.r.§.0.§.1.&lt;br /&gt;
 0000030: 30                                       0&lt;br /&gt;
&lt;br /&gt;
[[Category:Minecraft Modern]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Jrojro</name></author>
	</entry>
</feed>