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 can I be sure that UDP messages are received in order?
Why does the sockets buffer fill up sooner than expected?
What is difference between socket () and serversocket () class?
How do I get my server to find out the clients address / host- name?
Can multiple clients connect to same socket?
What is a socket address?
What is a deep well socket?
Where is the socket located?
How often should I re-transmit un-acknowleged messages?
How many sockets can a port have?
What are the pros/cons of select(), non-blocking I/O and SIGIO?
Are unix sockets faster than tcp?