linux - How to release socket? -


i'm making little tcp server , processes number of requests via threads. when server shutting down leaves unclosed sockets. how can close them automaticaly or somehow release on new launching of server? number of sockets big , don't want manage them hands.

any ideas?

where sockets created? within new thread or before thread started? if it's within thread, consider using pthread_cleanup_push() install handler closes socket (if it's still open) when thread exits.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -