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 |
What is a sae socket?
Why sockets are used?
system choose one for me on the connect() call? Should I bind() a port number in my client program, or let the?
What are socket exceptions? What is out-of-band data?
What is socket address?
How often should I re-transmit un-acknowleged messages?
How can I tell when a socket is closed on the other end?
What is the purpose of socket?
How can I read only one character at a time?
How can I force a socket to send the data in its buffer?
Can a single socket port be used for multiple applications?
How can I find the full hostname (FQDN) of the system I am running on?