So turns out it wasn't actually the code itself that was the issue. I did more messing around with the firewall trying to figure out why other programs were receiving packets and my .NET program wasn't; and it turns out that it was actually firewall rules that were blocking the incoming packets, but for an odd reason.
Because when running your .NET code in Visual Studio compiles the program down to an .exe
, windows prompts you to select firewall rules for the application communicating on either public or private networks.
When I first ran my project, I unchecked the public network box and only checked the private network box because that's what I usually do. But apparently not having the public network box checked was blocking the incoming packets from my ESP32.
I have never encountered this issue before and I will probably look into my network settings further to find the root of the issue. (New contract and router form provider likely frazzled a few things)
But TL;DR - Removing all firewall rules for incoming packets for the application, and then checking the public network option when I ran the .exe
again and was prompted finally allowed the packets through.
If anyone is willing to give any more tips I would greatly appreciate it as someone new to .NET and UDP in general. Thanks.