How do I properly close a socket?
Answer / chaitanya
This question is usually asked by people who try close(), because they have seen that that is what they are supposed to do, and then run netstat and see that their socket is still active. Yes, close() is the correct method. To read about the TIME_WAIT state, and why it is important, refer to ``2.7 Please explain the TIME_WAIT state.''.
| Is This Answer Correct ? | 0 Yes | 0 No |
Can a single socket port be used for multiple applications?
What is difference between socket and websocket?
How is a socket created?
What is LILO?
How do I get the port number for a given service?
What exactly does SO_KEEPALIVE do?
What are raw sockets?
What exactly does SO_LINGER do?
When should I use shutdown()?
Where is the socket located?
If bind() fails, what should I do with the socket descriptor?
How can my client work through a firewall/proxy server?