WSAECONNRESET

Started by
3 comments, last by Thorin_nz 20 years, 5 months ago
Hey guys, Just struck another problem reguarding sockets... When I create a UDP socket and send some data some place, then when I try to read data from the socket I get this error. WSAECONNRESET The virtual circuit was reset by the remote side executing a hard or abortive close. For UPD sockets, the remote host was unable to deliver a previously sent UDP datagram and responded with a "Port Unreachable" ICMP packet. The application should close the socket as it is no longer usable. I know that means that the destination is bung, but do I really have to recreate the socket each time an address is wrong? Thanks Steve
Advertisement
For connection oriented sockets, you would have to close and recreate the socket on your end. This is for TCP as well as UDP sockets for which you use connect() or accept().

For non-connected UDP sockets, I *BELIEVE* that this message just indicates the destination address/port pair was unreachable in a previous sendto(). You shouldn''t have to recreate the socket. There is an article (Q263823) in MSDN about this.

You should be able to ignore this error and continue on but YMMV.
Okay... Thanks for your help

[edited by - Thorin_nz on November 10, 2003 7:34:30 PM]
It seems like the WSAECONNRESETs would be 1-to-1 with your undeliverable packets so you may want to check this to avoid an infinite loop. I haven''t checked this tho.
This Win2000 bug was driving me mad the other day. I was testing a simple batch that started 10 clients to simulate a mmorpg environment (have to start out small hehe). Anyway I also simulated some disconnections by simply shutting down a few clients. After that it took up to a minute before new clients could connect to the server!! Was sure that my code was at fault somewhere but could find anything.
I finally added code to see if there were any Winsock error codes and found this one, phew.
The link provided by jermz was helpful in removing it also (didnt have to recreate socket or anything nasty). Maybe this should be a sticky post ?

This topic is closed to new replies.

Advertisement