Jump to content

RCon protocol: Difference between revisions

no edit summary
(Created page with "Server admins often need to manage their servers, but launching Zandronum is slow and inconvenient. The ''RCON protocol'' allows us to make tools that connect to servers quick...")
 
No edit summary
Line 20: Line 20:


Messages that the server sends to the client always begin with one of the following bytes:
Messages that the server sends to the client always begin with one of the following bytes:
<pre>
<syntaxhighlight lang="cpp" line="1" >
enum
enum
{
{
SVRC_OLDPROTOCOL = 32, //This set of enumerations starts at 32, increments by one
    SVRC_OLDPROTOCOL = 32, //This set of enumerations starts at 32, increments by one
SVRC_BANNED,
    SVRC_BANNED,
SVRC_SALT,
    SVRC_SALT,
SVRC_LOGGEDIN,
    SVRC_LOGGEDIN,
SVRC_INVALIDPASSWORD,
    SVRC_INVALIDPASSWORD,
SVRC_MESSAGE,
    SVRC_MESSAGE,
SVRC_UPDATE,
    SVRC_UPDATE,
        SVRC_TABCOMPLETE,
    SVRC_TABCOMPLETE,
        SVRC_TOOMANYTABCOMPLETES,
    SVRC_TOOMANYTABCOMPLETES,
};
};
</pre>
</syntaxhighlight>


Messages that the client sends to the server always begin with one of the following bytes:
Messages that the client sends to the server always begin with one of the following bytes:


<pre>
<syntaxhighlight lang="cpp" line="1" >
enum
enum
{
{
CLRC_BEGINCONNECTION = 52, // Also increments by one
    CLRC_BEGINCONNECTION = 52, // Also increments by one
CLRC_PASSWORD,
    CLRC_PASSWORD,
CLRC_COMMAND,
    CLRC_COMMAND,
CLRC_PONG,
    CLRC_PONG,
CLRC_DISCONNECT,
    CLRC_DISCONNECT,
        CLRC_TABCOMPLETE,
    CLRC_TABCOMPLETE,
};
};
</pre>
</syntaxhighlight>


Also, when the server sends SVRC_UPDATE, it's immediately followed by another byte:
Also, when the server sends SVRC_UPDATE, it's immediately followed by another byte:
<pre>
<syntaxhighlight lang="cpp" line="1" >
enum
enum
{
{
SVRCU_PLAYERDATA = 0,
    SVRCU_PLAYERDATA = 0,
SVRCU_ADMINCOUNT,
    SVRCU_ADMINCOUNT,
SVRCU_MAP,
    SVRCU_MAP,
};
};
</pre>
</syntaxhighlight>


== Connecting to a server ==
== Connecting to a server ==