Archived

This topic is now archived and is closed to further replies.

WSAECONNRESET

This topic is 5136 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 ?

Share this post


Link to post
Share on other sites