Indestructible sockets
Dave Higton (1515) 3534 posts |
I’ve been working on another sockets-based app, written in BASIC, for a while now. It’s a specialised HTTP server. Many times, when I close the app, sockets linger, despite calls in the app to close them on any kind of exit. If I try to close them from any external means, these sockets become indestructible – they never go away, their handles can’t be re-used, the total of available sockets goes down. (I’ve not actually run out of sockets yet, but…) Has anyone else seen this kind of behaviour? Sockets programmes tend not to be the sort of thing that can be reduced to an example of just a few lines, which is what you normally want when reproducing bugs. |
David Feugey (2125) 2709 posts |
Yes, I do. I explain: when WebJames stops working on my server, all sockets are left opened. So no way to launch it again (‘no sockets available’). I could close all sockets, but some are still used by other services, but which ones (anyway, you say it’s not possible)? Really something that should be managed by the kernel / Internet stack. |
John Sandgrounder (1650) 574 posts |
Yes, I have seen this with two ‘server’ applications. One written using the EasySockets module and the same application based on the !HTTPServr application from Stuart Brodie. Once the socket has been bound to an incoming port and incoming connections have been accepted, it is very difficult to close down the socket in a manner which enables the application to be restarted if it needs to bind to the same port – usually meaning that the system has to be rebooted. I aso use !WebJames, but that seems to behave itself for me. |