RCON Protocol
This page provides specifications for a TCP/IP connection over the remote console port (default 27011) to a Homefront dedicated server. All examples are given in C# and written as concise as possible to not obfuscate the specifications.
NOTE: In the latest version of the dedicated server expect Steam ID's (17 digit int) in ever situation where you would previously get a name. This change removes the possibility of name abuse by cheaters and allows for much better unicode name support.
List of current feature requests here.
Contents
|
Implementations
Homefront.Example
A very basic C# .NET 3.5 example of connecting to a Homefront server. Download
Packet Format
Message Type
- Type: 8-bit char[]
- Byte Length: 2
- Values
- Connect, Data: "CC"
- Client Transmission, Data: "CT"
- Client Disconnect, Data: "CD"
- Client Ping, Data: "CP"
- Server Announce, Data: "SA"
- Server Transmission, Data: "ST"
- Server Disconnect, Data: "SD"
- Server Response, Data: "SR"
Channel Type
- Type: 8-bit byte
- Byte Length: 1
- Values
- Broadcast, Data: 0
- Normal, Data: 1
- Chatter, Data: 2
- Gameplay, Data: 3
- Server, Data: 4
Data Length
- Type: 32-bit signed int (big-endian)
- Byte Length: 4
Data
- Important change: With the next dedicated server update (coming soon to 29/03/2011), this data will need to be sent using UTF8 encoding in order to support unicode.
- Type: 8-bit UTF8 char[N]
- Byte Length: N
- Description: UTF8 String. N is the Data Length.
- See http://en.wikipedia.org/wiki/UTF-8 for more information on UTF8 encoding.
Packet
Outgoing
- Packet: [ #Message Type ] [ #Data Length ] [ #Data ]
- Bytes
- 0..1: #Message Type
- 2..5: #Data Length
- 6..N: #Data
C# Outgoing Packet Encoding Example
char[] MessageType = new char[] { 'C', 'T' };
string Data = "admin kick \"Phogue\"";
int DataLength = Encoding.UTF8.GetBytes(Data).Length;
int HeaderSize = MessageType.Length + sizeof(int);
byte[] packet = new byte[HeaderSize + DataLength];
Encoding.ASCII.GetBytes(MessageType).CopyTo(packet, 0);
packet[2] = (byte)((DataLength >> 24) & 255);
packet[3] = (byte)((DataLength >> 16) & 255);
packet[4] = (byte)((DataLength >> 8) & 255);
packet[5] = (byte)(DataLength & 255);
Encoding.UTF8.GetBytes(Data).CopyTo(packet, HeaderSize);
// Send(packet);
Incoming
- Packet: [ #Message Type ] [ #Channel Type ] [ #Data Length ] [ #Data ]
- Bytes
- 0..1: #Message Type
- 2: #Channel Type
- 3..6: #Data Length
- 7..N: #Data
C# Incoming Packet Decoding Example
char[] MessageType = new char[2];
MessageType[0] = (char)packet[0];
MessageType[1] = (char)packet[1];
byte ChannelType = packet[2];
int DataLength = (int)(packet[3] << 24 |
packet[4] << 16 |
packet[5] << 8 |
packet[6]);
int HeaderSize = MessageType.Length + sizeof(byte) + sizeof(int);
string Data = Encoding.UTF8.GetString(packet, HeaderSize, DataLength);
// Dispatch(MessageType, ChannelType, Data);
Keep-Alive
The server will forcibly close the connection if no activity has occurred in a 10 second interval. See #PING for details on sending a keep alive ping to the server.
Server Events
BROADCAST
- #Message Type: ServerTransmission
- #Channel Type: Chatter
- #Data: BROADCAST:[string: Name] [string: Context]: [string: Text]
- Examples
- BROADCAST:Phogue says: Hello
- BROADCAST:Phogue (team)says: Hello
- Name: The name of the author of the message
- Context
- "says" for global chatter
- "(team)says" for team chatter
- "(squad)says" for squad chatter
- Text: What the player said
- Notes
- This server message still uses player names (as opposed to Steam IDs).
- Examples
Global Chatter
- #Message Type: ServerTransmission
- #Channel Type: Chatter
- #Data: [string: Text]
- Example
- Hello
- Text: What the player or server said
- Notes: This message is visible to all players on the server and either originated from a player or the server.
- Example
CHANGE_LEVEL
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: CHANGE_LEVEL: [string: Map]
- Example
- CHANGE_LEVEL: fl-harbor
- Map: The map the server is changing to
- Notes: Fires when the server is changing levels
- Example
HELLO
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: HELLO: [int: Version]
- Example
- HELLO: 362682
- Version: The servers version number
- Example
LOGIN
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: LOGIN: [string: Name] [int: SteamID]
- Example
- LOGIN: Phogue 76561198001346241
- Name: The name of the player who connected
- SteamID: The steam ID that uniquely identifies this account
- Notes: Sent once a player has connected to the server
- Example
UID
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: UID: [string: Name] [int: SteamID]
- Example
- UID: Phogue 76561198001346241
- Name: The name of the player
- SteamID: The unique Steam ID of the player
- Notes: This is the steam community id of the player. Soon to be deprecated as the Steam ID is now sent on login.
- Example
LOGOUT
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: LOGOUT: [int: SteamID]
- Example
- LOGOUT: 76561198001346241
- SteamID: The steam ID of the player logging out
- Notes: Sent when a player disconnects from the server
- Example
KILL
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: KILL: [int: Killer SteamID] [string: DamageType] [int: Victim SteamID]
- Examples
- KILL: 76561198001346241 EXP_Frag 76451789006646241
- Killer Name: The Steam ID of the killer
- DamageType: The damage type (weapon) the killer used to kill the victim
- Victim Name: The Steam ID of the victim
- Examples
TEAM CHANGE
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: TEAM CHANGE: [int: SteamID] [int: Team ID]
- Example
- TEAM CHANGE: 76561198001346241 1
- SteamID: The unique ID of the player who changed teams
- Team ID: The ID of the team
- 0 = KPA
- 1 = USA
- 2 = SPEC
- Example
ROUND OVER
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: ROUND OVER: [int: Team ID]
- Example
- ROUND OVER: 1
- Team ID: The ID of the winning team
- 0 = KPA
- 1 = USA
- 2 = TIE
- Example
CLAN CHANGE
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: CLAN CHANGE: [int: SteamID] [string: Clan Name]
- Example
- CLAN CHANGE: 76561198001346241 BBD
- SteamID: The unique ID of the player who changed their clan tags
- Clan Name: The prefixed clan tags of a players name
- Example
RCON AUTH NOTIFY
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: RCON AUTH NOTIFY: [int: Port] [string: IP] [boolean: Authenticated]
- Example
- RCON AUTH NOTIFY: 27010 127.0.0.1 true
- Port: The port connected to
- IP: The remote IP address connected to the rcon
- Authenticated: If the remote connection passed authentication
- Example
PLAYER INFO
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: PLAYER: [string: Steam ID] [int: Team] [string: Clan] [string: Name] [int: Kills] [int: Deaths]
- Example
- PLAYER: 76543210987654321 1 Dix_Ex uFalcon 180 2
- Remarks
- PLAYER transmissions come back as a result of a RETRIEVE PLAYERLIST command being sent to the server.
- The team number can be invalid (team #3) if the list is retreived as a match is starting up. In this case subsequent TEAM CHANGE events should provide the correct team.
- Steam ID: The player's Steam ID.
- Team: Team number, 0 is KPA, 1 is USA, 2 is Spectator, 3 is None
- Clan: Steam group this player picked as a clan tag
- Name: Player name
- Kills: Current kills this round
- Deaths: Current deaths this round
- Example
BAN ITEM
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: BAN ITEM: [string: Name] [int: Steam ID]
- Example
- BAN ITEM: Gri3f3r002 76543210987654321
- Remarks
- BAN ITEM transmissions come back as a result of a RETRIEVE BANLIST command being sent to the server.
- Ban items from current game round are not shown.
- Name: Name of player banned
- Steam ID: The player's Steam ID.
- Example
BAN ADDED
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: BAN ADDED: [string: Name] [int: SteamID]
- Example
- BAN ADDED: Zangen 76561198001346241
- Name: Name of player banned
- SteamID: Unique ID of player
- Example
BAN REMOVE
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: BAN REMOVE: [int: Steam ID]
- Example
- BAN REMOVE: 76561198001346241
- Steam ID: Steam ID of player that is unbanned
- Example
SERVERAB
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: SERVERAB: [boolean: On]
- Example
- SERVERAB: True
- On: Whether or not server-side autobalance is enabled
- Example
VOTESTART
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: VOTESTART: [int: SteamID] [string: VoteType] [optional string: Target]
- Examples
- VOTESTART: 99981547865418904 NextMap
- VOTESTART: 99981547865418904 Kick DE_Smashbomb
- Player: The player that initiated the vote
- VoteType: The type of vote (arbitrary although "NextMap", "Restart", "Kick", and "KickBan" denote the server-side effect that corresponds to their name)
- Target: The optional target of the vote
- Examples
VOTE
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: VOTE: [int: Steam ID] [boolean: Yes]
- Example
- VOTE: 99981547865418904 1
- Steam ID: Steam ID of the player voting.
- Yes: 1 is vote for, 0 is vote against.
- Example
VOTEEND
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: VOTEEND: [int: YesVotes] [float: PercentFor] [string: Pass]
- Example
- VOTE: VOTEEND: 2 0.75 passed
- VOTE: VOTEEND: 4 0.15 failed
- YesVotes: Number of players that voted yes
- PercentFor: Percent of total players that voted yes (as a float)
- Pass: "passed" for success, "failed" for failure
- Example
Client Commands
PASS
- #Message Type: ClientTransmission
- #Data: PASS: "[string: SHA1Hash]"
- Example
- PASS: "D2 EA 1A 2E 9E 36 5D 75 3D A0 2F 6F C2 AF 33 0C BB 5B 14 2B"
- SHA1Hash: A 60 byte ASCII string with a 40-bit SHA1 Hash converted to uppercase hexadecimal text and spaces inserted between each pair.
- Example
- Response
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: AUTH: [boolean: Result]
- Example
- AUTH: true
- Result: A boolean showing the success or failure of the login attempt
- false = Authentication failed! Incorrect password supplied.
- true = Authentication successful.
- Example
C# Example
String PlainTextPassword = "rcon";
SHA1CryptoServiceProvider SHA1Hasher = new SHA1CryptoServiceProvider();
byte[] PlainTextPasswordBytes = Encoding.ASCII.GetBytes(PlainTextPassword);
byte[] SHA1PasswordBytes = SHA1Hasher.ComputeHash(PlainTextPasswordBytes);
String SHA1Password = String.Join(" ", SHA1PasswordBytes.Select(x => x.ToString("X2")).ToArray());
// Send("PASS: \"{0}\"", SHA1Password);
admin adminsay
- #Message Type: ClientTransmission
- #Data: adminsay [string: Text]
- Example
- adminsay Hello World!
- Text: The message to broadcast to all players on the server (quotes around this param are optional)
- Example
- Response
- While this packet has no direct response a #Global Chatter event will be triggered to echo the text back from the server.
- Note
- DE's Dedicated Server Tool will automatically translate say to adminsay, so you can just type "say Hello World!"
admin adminbigsay
- #Message Type: ClientTransmission
- #Data: admin adminbigsay [string: Text]
- Example
- adminbigsay Hello World!
- Text: The message to broadcast to all players in the Message of the Day widget (quotes around this param are optional)
- Example
- Response
- None,
- Note
- DE's Dedicated Server Tool will automatically translate bigsay to adminbigsay so you can just type "bigsay No griefing on this server!"
admin adminpm
- #Message Type: ClientTransmission
- #Data: admin adminpm [string: PlayerID] [string: Text]
- Example
- adminpm uFalcon Keep killing so many dudes and you'll get booted!
- PlayerID: The name or Steam ID of the player you wish to PM (quotes around this param are optional)
- Text: The message to broadcast to all players in the Message of the Day widget (quotes around this param are optional)
- Example
- Response
- None,
- Note
- DE's Dedicated Server Tool will automatically translate pm to adminpm, so you can just type "pm ufalcon hello, there"
admin kick
- #Message Type: ClientTransmission
- #Data: admin kick "[string: PlayerID]"
- Example
- admin kick "Phogue"
- admin kick "76543210987654321"
- PlayerID: The name or Steam ID of the player to kick out of the server
- Example
- Response
- None.
admin kill
- #Message Type: ClientTransmission
- #Data: admin kill "[string: PlayerID]"
- Example
- admin kill "Phogue"
- admin kill "76543210987654321"
- PlayerID: The name or Steam ID of the player to kill
- Example
- Response
- None.
admin NextMap
- #Message Type: ClientTransmission
- #Data: admin NextMap
- Notes: Forces a map change to the next map in the rotation
- Response
- None.
admin SetAutoBalance
- #Message Type: ClientTransmission
- #Data: admin SetAutoBalance [bool: Enabled]
- Example
- admin SetAutoBalance true
- Enabled
- true – Autobalance on
- false - Autobalance off
- Example
- Response
- None.
admin makespectate
- #Message Type: ClientTransmission
- #Data: admin makespectate "[string: PlayerID]"
- Example
- admin makespectate "Phogue"
- PlayerID: The name or Steam ID of the player to make a spectator
- Notes: Kills and swaps a player to a spectator
- Example
- Response
- None.
admin forceteamswitch
- #Message Type: ClientTransmission
- #Data: admin forceteamswitch "[string: PlayerID]"
- Example
- admin forceteamswitch "Phogue"
- PlayerID: The name or Steam ID of the player to force the team swap on
- Notes: Kills and swaps a player to the opposite team
- Example
- Response
- None.
admin kickban
- #Message Type: ClientTransmission
- #Data: admin kickban "[string: PlayerID]" "[string: Admin]" "[string: Reason]"
- Example
- admin kickban "Hassan"
- admin kickban "76543210987654321"
- admin kickban "Hassan" "Ike"
- admin kickban "Hassan" "Phogue" "Not sharing your hustled competition winnings"
- PlayerID: The name or Steam ID of the player to permanently ban from the server
- Admin (optional): The name of the admin that enforced the ban
- Reason (optional): A reason for the ban
- Example
- Notes: Kicks and permanently bans a player from the server.
- Response
- See #BAN ADDED
admin unban
- #Message Type: ClientTransmission
- #Data: admin unban "[string: PlayerID]"
- Example
- admin unban "Phogue"
- admin unban Phogue
- admin unban "76561198001346241"
- admin unban 76561198001346241
- PlayerID: The name or Steam ID of the player to unban from the server
- Example
- Response
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: BAN REMOVE: [int: SteamID]
- Example
- BAN REMOVE: 76561198001346241
- SteamID: Unique ID of player who was unbanned
- Example
PING
- #Message Type: ClientPing
- #Data: PING
- Notes: Used as a keep alive for the connection. With the current TCP RCON protocol, if the server doesn't receive any data from an RCON client for 10 seconds the connection is assumed to be lost and the port re-opened.
- Response
- #Message Type: ServerTransmission
- #Channel Type: Server
- #Data: PONG
RETRIEVE BANLIST
- #Message Type: ClientTransmission
- #Data: RETRIEVE BANLIST
- Notes: Causes BAN ITEM events to be sent to the RCON client
- Response
- See BAN ITEM
RETRIEVE PLAYERLIST
- #Message Type: ClientTransmission
- #Data: RETRIEVE PLAYERLIST
- Notes: Causes PLAYER events to be sent to the RCON client
- Response
- See PLAYER INFO