Killing a blocked UDP socket

Suppose I have a UDP socket that was open on a specific address / port and then hanged. When I try to initialize a new UDP socket ( UDPClient ) at the same address / port, of course, it throws a SocketException as it finds that it is already in use.

Is it possible to kill a hanging socket from code so that I can reuse it?

EDIT: here is the code causing the UDP block (apparently) Gracefully closed UDPClient leaves the blocked socket

+6
source share
1 answer

You can set the ReuseAddress socket option to a socket so that it can listen on the same IP address and port on a different socket.

0
source

All Articles