Hi,
I'm using UDPClient to make a simple DNS server. I notice that
intermittently and unpredictibly I get:
Unhandled Exception: System.Net.Sock ets.SocketExcep tion: An existing
connection
was forcibly closed by the remote host
at System.Net.Sock ets.Socket.Rece iveFrom(Byte[] buffer, Int32 offset,
Int32 s
ize, SocketFlags socketFlags, EndPoint& remoteEP)
at System.Net.Sock ets.UdpClient.R eceive(IPEndPoi nt& remoteEP)
at dnsone_c.CoolUD P.Receive()
at dnsone_c.Progra m.Main(String[] args)
If I try to restart the server right away, I get:
Unhandled Exception: System.Net.Sock ets.SocketExcep tion: Only one usage of
each
socket address (protocol/network address/port) is normally permitted
at System.Net.Sock ets.Socket.DoBi nd(EndPoint endPointSnapsho t,
SocketAddress
socketAddress)
at System.Net.Sock ets.Socket.Bind (EndPoint localEP)
at System.Net.Sock ets.UdpClient.. ctor(IPEndPoint localEP)
at dnsone_c.CoolUD P.Receive()
at dnsone_c.Progra m.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.c om