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
Post a Comment