Vb rcon

Novocaine

Newbie
Joined
Jan 13, 2009
Messages
1
Reaction score
0
Hi,

I know this has already been done but I though it would be a good way to expand my knowledge in VB.

I'm trying to create a VB applcation that can send commands to a source server.
I've seen many, many examples but I have not been ableto get mine to work.

Here is what I'm working with :

Code:
         ' Create a udp client 
        Dim t As System.Net.Sockets.UdpClient
        t = New System.Net.Sockets.UdpClient()

        ' try to connect to source server 
        t.Connect("xx.xx.xx.xx", xxxxx)

        ' Define query 
        Dim byteBuffer As Byte() = {&HFF, &HFF, &HFF, &HFF, &H55}

        ' send query to server 
        t.Send(byteBuffer, byteBuffer.Length)

        ' Create endpoint - listen for a reply 
        ' it will halt here until reply is received 
        Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Any, 0)

        ' receive reply 
        Dim receiveBytes As Byte() = t.Receive(RemoteIpEndPoint)

        Dim returnData As String = Encoding.ASCII.GetString(receiveBytes)
        If Me.TextBox3.InvokeRequired Then
            Dim d As New SetTextCallback(AddressOf SetText)
            Me.Invoke(d, New Object() {returnData & vbCrLf})
        End If

        ' close the client 
        t.Close()

This code is assigned to a button click, the only output I get back is "????A?-Z"
I'm not sure where to proceed from here so any help would be great.
 
Back
Top