I just started working with the UDPClient in .Net(Core 2). and noticed that upon receive, it can actually throw a "remote has closed connection" exception. This doesn't make much sense to me since UDP does not care for remotes.
I receive UDP Data from an application i have no control over. What i do in short is this:
if(MyUDPClient.Available > 0)
{
IPEndPoint Point = null;
Byte[] Data = MyUDPClient.Receive(ref point);
//[do something with data]
}
However during the lifetime of said application(while i receive Data, above is done in a loop), the call to Receive can throw the exception that the remote has closed the connection(which it didn't...).
Can someon explain to me why this exception is even a thing and maybe even a workaround? All i want is receive Data and identify from which endpoint it orriginated.