I am trying to asynchronously receive UDP commands from my other program. I am using the code below which works great, once. But if i resend the command, it doesn't receive it.
How do I continuously receive UDP packets?
vb.net Code:
Private Sub startListening() ReceivingUdpClient = New System.Net.Sockets.UdpClient(listenPort) ThreadReceive = New System.Threading.Thread(AddressOf receiveMessages) ThreadReceive.Start() End Sub Private Sub receiveMessages() Dim receiveBytes As [Byte]() = ReceivingUdpClient.Receive(RemoteIpEndPoint) MsgBox(Encoding.ASCII.GetString(receiveBytes)) 'the end goal is a Case but message box for debugging End Sub




Reply With Quote