I have a UDP library that works fine in .Net 4.x but I am trying to port it to .NET Core for use with an ASP Net Core MVC site. The site sends and receives UDP datagrams from sensors via a third-party 'server'. The UDP protocol with the 'server' is fixed, so connected sockets are not an option.
A UDP listener is to be started when a user logs on and stopped when there are no more users. My question is, apparently with only ReceiveAsync available in Core (BeginReceive/EndReceive having disappeared), how to kill a receiving loop.
So far as I can see, a call to ReceiveAsync only returns when a datagram is received. Thus, short of the site sending itself a terminating datagram, I can't see how to interrupt the process.
Any suggestions, please?