-
Feb 15th, 2025, 11:18 AM
#1
Thread Starter
New Member
VB.net Program not receiving UDP packets
Hello
Ten years ago I wrote a VS Visual Basic application to receive messages sent by my android smartphone in UPD on my PC.
Today I'm trying to use this application again, but it's not receiving anything.
I know that the android app works and sends requests because I receive them on my PC with an application like UDP Test Tool (https://udp-test-tool.informer.com).
So the problem is on the PC side. I tried different examples of code to receive UDP packets, with or without thread, but without success.
Here's an example:
Code:
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
'https://learn.microsoft.com/fr-fr/dotnet/framework/network-programming/using-udp-services
Dim listenPort As Integer = 13000
Dim listener As New UdpClient(listenPort)
Dim groupEP As New IPEndPoint(IPAddress.Any, listenPort)
Try
While True
Console.WriteLine("Waiting for broadcast")
Dim bytes As Byte() = listener.Receive(groupEP)
Console.WriteLine("Received broadcast from {groupEP} :")
Dim receiveString As String = Encoding.ASCII.GetString(bytes)
Label_Reception.Text = receiveString
End While
Catch ex As SocketException
Console.WriteLine(ex.ToString())
Finally
listener.Close()
End Try
End Sub
On the Windows Defender firewall, I authorized the receiving Visual Basic PC application to communicate (private network).
On the Box side, I tried to open the port used, but I don't really know what to do.
But to no avail, my application still receives nothing and I don't know what to do.
That's why I'm asking for your help.
thanks
-
Feb 16th, 2025, 09:52 AM
#2
Thread Starter
New Member
Re: VB.net Program not receiving UDP packets
Thanks
I will test this tomorrow monday.
-
Feb 18th, 2025, 10:35 AM
#3
Thread Starter
New Member
Re: VB.net Program not receiving UDP packets
Unfortunatly , this didn't change nothing.
-
Feb 21st, 2025, 07:31 PM
#4
Re: VB.net Program not receiving UDP packets
 Originally Posted by Pierre_1965
Then the problem has to be with your application. I don't trust IPAddress.Any. Try using your PC's actual IP address first and see if that works.
-
Feb 25th, 2025, 08:15 AM
#5
Thread Starter
New Member
Re: VB.net Program not receiving UDP packets
Thanks Niya
I solved my problem by disabling the firewall for the private network.
It was the same problem with PC's actual IP instade of IPAddress.Any.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|