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 |
How is a socket created?
How do unix sockets work?
What are Sockets?
Can multiple sockets use the same port?
How does unix socket work?
Can a single socket port be used for multiple applications?
What is with the second parameter in bind()?
Explain the TIME_WAIT state.
How can I listen on more than one port at a time?
How can I find the full hostname (FQDN) of the system I am running on?
Is socket a hardware or software?
How come only the first part of my datagram is getting through?