This is my first article on CodeProject.
RCON (Remote Console) is used to manage game servers remotely. RCON commands can be sent through games. But in my recent project, I had to send RCON commands through software. After doing a lot of R&D, I was able to find a way in which Quake based games send RCON commands to the server.
RCON command syntax is as follows:
0xFF 0xFF 0xFF 0xFF 0x02 rcon password command
The first five characters are special and should be sent before any RCON command. Every RCON command should contain the RCON password. I set the RCON password for MOHAA by executing the following command in the console:
set rconpassword 123456
I test the code on MOHAA and Medal of Honor SpearHead. But I think it will work fine on other games which are based on Quake Engine.
Using the Code
I have written a class with the name
RCON. It has one method,
sendCommand. Pass it a game server IP, port, password and RCON command and this method returns a response from the server.
I use this method for Mohaa as follows:
rcon.sendCommand(txtCommand.Text, txtGameServerIP.Text, "123456", 12203);