I am using the standard WinSock functions for socket communication, Now suppose I create a socket and my program terminates abruptly Is there any chance that the socket remains active ?
I tried a little example, first call to the socket API returned 4986, after abruptly terminating the executable the second call to the socket API returned 4946
But I still feel that the socket if not closed remains active for sometime.
Please help me clarify my doubt
On linux machines if you open a socket with a program, then close the program uncleanly i.e. crash it, the socket will remain open. The operating system will clean up these bound sockets in this scenario after a time period has passed (I am not sure how long it is, I assume it specified some where in the OS, it is less than 10 minutes).
http://compgroups.net/comp.os.ms-windows.programmer.win32/bind-error-after-crash-ho/368539
I assume this would mean that the WinSock’s do remain open after you crash or forget to close them with your application. I am not sure how windows handles these open sockets but I make inference it would be similar to linux and close them after a time period has elapsed