Search code examples
vb.netpackets

VB Send Rcon commands and get response back. (CS:GO Servers)


I am trying to make a connection with a CS:GO game server using Rcon.

all I would like to do is send the "status" command to get player list for now, once I get that sent, I can probably figure out how to send other commands.

Edit: Like this.

SendCommand(IP,Port,Command) - Idk if it could be done like this.

Im not sure if I can just send the command "rcon_password 1234" then "rcon status"

It sounds simple to me, until I google it and find out how others have done it for Quake and CoD...

I don't know where to start, any help is appreciated.

Found this, Not sure how or what to do with it... I don't know much about network related programming with packets and such... :S

 Private Function RCON_Command(ByVal Command As String, ByVal ServerData As Integer) As Byte()
 Dim Packet As Byte() = New Byte(CByte((13 + Command.Length))) {}
 Packet(0) = Command.Length + 9       'Packet Size (Integer)
 Packet(4) = 0                        'Request Id (Integer)
 Packet(8) = ServerData               'SERVERDATA_EXECCOMMAND / SERVERDATA_AUTH (Integer)
 For X As Integer = 0 To Command.Length - 1
     Packet(12 + X) = System.Text.Encoding.Default.GetBytes(Command(X))(0)
 Next
 Return Packet

End Function


Solution

  • I have found a way around this, I have found a project that will do what I need, All I have to do is work it into my project.

    I just edited it to send the servers response to a file and have my main project read it.

    ex: shell("/c file.exe IP PORT PASSWORD CMD")

    If anyone wants to see: https://github.com/aiusepsi/SourceRcon