Im trying to send one single UDP packet to a bf2 server, and get a single packet response back. Unfortunately, I cannot find any info or help on the topic!
It blocks on .Receive and I never get a response, can anyone help me??
VB.NET:
Imports System.Net
Public Class UDPWinsock
Dim ServerIP As String
Public Property Server() As String
Get
Return ServerIP
End Get
Set(ByVal value As String)
ServerIP = value
End Set
End Property
Public Function Send(ByVal Text As String) As String
Dim toBytes As [Byte]() = System.Text.Encoding.ASCII.GetBytes(Text)
Dim ipAddr() As String = ServerIP.Split(":"c)
Dim Winsock As New Net.Sockets.UdpClient
Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Any, 0)
Dim ReturnData As [Byte]()
With Winsock
.Send(toBytes, toBytes.Length, ipAddr(0), Convert.ToInt32(ipAddr(1)))
ReturnData = .Receive(RemoteIpEndPoint)
End With
Return System.Text.Encoding.ASCII.GetString(ReturnData)
End Function
End Class
It blocks on .Receive and I never get a response, can anyone help me??