RCON

RCON

 

The Source RCON Protocol is a TCP/IP-based communication protocol used by Source Dedicated Server, which allows console commands to be issued to the server via a "remote console", or RCON. The most common use of RCON is to allow server owners to control their game servers without direct access to the machine the server is running on.

 

Configuration

The RCON_Options allows to configure the following properties:

 

 

Connect

Use the property Active to Connect / Disconnect from server.

When Active is set to True, the client tries to connect to the server, if can connect, it will try to authenticate using the provided password.

The server will send a response to a Authentication request, the event OnAuthenticate will be called and you can read if authentication is successful or not using the Authenticate parameter.

 

Send Commands

Use the method ExecCommand to send commands to the server. The responses will be available OnResponse Event.

 


oRCON := TsgcLib_RCON.Create(nil);
oRCON.RCON_Options.Host := '127.0.0.1';
oRCON.RCON_Options.Port := 25575;
oRCON.RCON_Options.Password := 'test';
oRCON.Active := True;

procedure OnAuthenticate(Sender: TObject; Authenticated: Boolean; const aPacket: TsgcRCON_Packet); begin   if Authenticated then     DoLog('#authenticated')   else     DoLog('#not authenticated'); end;
procedure OnResponse(Sender: TObject; const aResponse: string; const aPacket: TsgcRCON_Packet); begin   DoLog(aResponse); end;