Hi,
I'm using UDPClient to make a simple DNS server. I notice that
intermittently and unpredictibly I get:
Unhandled Exception: System.Net.Sockets.SocketException: An existing
connection
was forcibly closed by the remote host
at System.Net.Sockets.Socket.ReceiveFrom(Byte[] buffer, Int32 offset,
Int32 s
ize, SocketFlags socketFlags, EndPoint& remoteEP)
at System.Net.Sockets.UdpClient.Receive(IPEndPoint& remoteEP)
at dnsone_c.CoolUDP.Receive()
at dnsone_c.Program.Main(String[] args)
If I try to restart the server right away, I get:
Unhandled Exception: System.Net.Sockets.SocketException: Only one usage of
each
socket address (protocol/network address/port) is normally permitted
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot,
SocketAddress
socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at System.Net.Sockets.UdpClient..ctor(IPEndPoint localEP)
at dnsone_c.CoolUDP.Receive()
at dnsone_c.Program.Main(String[] args)
After about a minute, this goes away and I can restart the program as usual.
Is the problem maybe that I'm both sending and receiving out of the same
UDPClient object? It's like something's getting in the way and blocking the
port and the program throws a fit.
Thanks,
--Jon
j@fourtentech.com