Let's assume I have an UDP socket that was open on a certain address / port and then hanged.
When I try to initialize a new UDP Socket (UDPClient
) on that same address / port of course it raises a SocketException since it finds that is already in use.
Is it possible to kill from code the hanged socket so I can reuse it?
EDIT: Here's the code causing the UDP to stay blocked (Apparently) Gracefully Closed UDPClient leaves the socket blocked
.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true)
before connecting with a new socket. – Dichroite