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 |
Is socket a hardware or software?
How would I put my socket in non-blocking mode?
How can I read only one character at a time?
over the socket? Is there a way to have a dynamic buffer? What does one do when one does not know how much information is coming?
What is a deep well socket?
What is difference between socket and websocket?
What are the pros/cons of select(), non-blocking I/O and SIGIO?
What exactly does SO_LINGER do?
Are sockets files?
What is sae socket?
of the socket? Does doing a connect() call affect the receive behaviour?
What is the difference between read() and recv()?