I'm struggling to get a dotnet core console application to receive a UDP message. When I use the same code in a dotnet framework console app, the messages are received, so I feel nothing should be blocking them (ie. firewall, etc.).
I've tried running this project using Visual Studio, and published a release version and run using dotnet in a command window, but nothing is received. No exceptions. It seems so simple. I'm at a loss. Any advice is appreciated. Thanks.
This is the code:
static void Main(string[] args)
{
var client = new UdpClient(10006);
var ipEndPoint = new IPEndPoint(IPAddress.Any, 0);
var msgReceived = client.Receive(ref ipEndPoint);
Console.WriteLine($"received '{Encoding.ASCII.GetString(msgReceived)}'");
}
I see the same/similar question asked here, without an answer: How to send and receive commands from a UDP network server via .NET Core console application