I have 100+ sockets in my server application, should I call closesocket()
on these 100+ sockets when my application is about to close?
Is it possible for closesocket()
not to return until the connection is closed for each socket, and hence delay the time it takes for my application to close?
Letting the OS close a socket (or free memory, etc) is a safety feature and should not be solely relied on. It is always a good idea to have a clean exit where your code cleans up after itself.
In C, you would be using close(). See the socket man page for questions on delay: http://linux.die.net/man/7/socket