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 |
Why do I keep getting EINTR from the socket calls?
Is a socket a file?
Whats the difference between select() and poll()?
How many sockets can a cpu have?
What is sae socket?
What is the difference between a socket and a port?
Explain the TIME_WAIT state.
Is tcp or unix socket faster?
How does a socket work?
Why does connect() succeed even before my server did an accept()?
How come select says there is data, but read returns zero?
Is socket a hardware or software?