Delphi RCON Client

From sgcWebSockets 4.5.1 RCON protocol is supported. 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:

  • Host: server remote address.
  • Port: server listening port.
  • Password: is the secret string used to authenticate against the server

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; 
×
Stay Informed

When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.

Delphi CryptoHopper Client
SChannel Cipher List and Connection Info

Related Posts