Gents --
Gents --
I know this is a totally open ended question with little information, but here goes......
Can anyone think of a reason that a socket server application would hum along just fine accepting connections, and then suddenly stop, giving the dreaded 10061 error (Connection actively refused)?
That's happening to me and I don't have many more details than that.
I know this is a totally open ended question with little information, but here goes......
Can anyone think of a reason that a socket server application would hum along just fine accepting connections, and then suddenly stop, giving the dreaded 10061 error (Connection actively refused)?
That's happening to me and I don't have many more details than that.
I would just like to point out we have a few very fine ladies around here who may rightfully feel that "gents" does not represent them :-)
ReplyDeleteAre you leaking socket handles and run out?
ReplyDeleteIf threads are involved, the creating thread owns the responsibility from cradle to grave, and trying to release the handle in the wrong thread causes a leak, if I remember correctly.
ReplyDeleteAndrea -- You are correct --- my apologies.
ReplyDeleteLars -- how do you leak a socket handle?
ReplyDeleteI should add that this is hand-code, raw WinSock code.
Nick Hodges Whose hand-code? Yours? Or legacy stuff?
ReplyDeleteLet me count the ways from the top of my head...
ReplyDeleteMismatched
- WSAStartup/WSACleanup
- Connect/Disconnect
- AcceptEx/CloseSocket
and various other combos.
If you are leaking handles - that should be easy to verify with SysInternals TCPView or SysInternals Process Explorer, or Process Hacker.
ReplyDeleteIf you have MadExcept 4+, it also has the ability to show you any resource leaks.
ReplyDeleteI once had similar problems. Sporatic 10061s. After chasing this for a couple of weeks, we found a loose cable in the local hub. Fixed it and no more 10061s!
ReplyDeleteNever rule out hardware failure.
ReplyDeleteLars -- Found a WSAStartup call, but no WSACleanup. Matching with a WSACLeanup didn't seem to help.
ReplyDeleteHow does TCPView report leaking handles?
If you have a growing number of idle (Established / Listening - but no traffic) ports, they are probably connections which have not been closed correctly. I don't know if you control both ends of the session, or if there is a protocol layer - but if you have - you might want to check that the protocol hangs up correctly as well.
ReplyDeleteIf you can't find indications of a handle leak - another options could be some sort of memory corruption?
fiddler mikey To the contrary, rule it out early, be sure, as it's easier to remedy than chasing all over the place in code, trying to discover what may not be there.
ReplyDeleteI think fiddler mikey meant that you should check your HW, Bill Meyer.
ReplyDeleteNick Hodges - Same symptom on different hardware?
I didn't write the code.... it's legacy. I own both ends of the connection. I'm confident hardware isn't the issue.
ReplyDeleteYes Lars Fosdal trying to convey a rational message on a mobile device doesn't always work out so well.
ReplyDeleteIf you find the cause, Nick Hodges - it would be fun to know what it was :)
ReplyDeleteSounds like ressource exhaustion or a network timing issue to me. How many connections does the server accept until it happens, and what is the component you're using? Do you have a network trace of working and failing connections?
ReplyDeleteJasper Thayer resource exhaustion gives another error code. Nick Hodges error 10061 is sent by the OS whenthere is no application listening on the port. This could also comes from buggy "security" product which poorly intercept winsock calls. It can also happen with malware intercepting winsock call. When you use netstat, does it still shows a listening port on the expected port/protocol? A bug in the software could inadvertely close the listening socket handle.
ReplyDelete