a_jam_sandwich
Junior Contributor
Im just messing around with sockets as uptill now I not really touched it. Anyway I want to create a server query tool for halflife servers.
Here is the code so far very simple as you will see
The problem is Im not receiving any packets back the protocol is as from I have done this in PHP and it worked.
http://phxx.net/faq.asp?pid=22
Anyone have any ideas
Thanks
Andy
Here is the code so far very simple as you will see
Visual Basic:
Dim MyUDP As New UdpClient
Dim MyIP As IPAddress = IPAddress.Parse("195.149.21.70")
MyUDP.Connect(MyIP, 27015)
Dim Command As [Byte]()
Command = Encoding.ASCII.GetBytes(Chr(255) & Chr(255) & Chr(255) & Chr(255) & "players")
MyUDP.Send(Command, Command.Length)
Console.WriteLine("Sent")
Dim RemoteIpEndPoint As New IPEndPoint(MyIP, 27005)
Try
Dim receiveBytes As [Byte]() = MyUDP.Receive(RemoteIpEndPoint)
Dim returnData As String = Replace(Encoding.ASCII.GetString(receiveBytes), Chr(0), "|")
Console.WriteLine(returnData)
Catch ex As Exception
Console.WriteLine(ex.ToString())
End Try
MyUDP.Close()
The problem is Im not receiving any packets back the protocol is as from I have done this in PHP and it worked.
http://phxx.net/faq.asp?pid=22
Anyone have any ideas
Thanks
Andy