How do I properly close a socket?



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

Post New Answer

More Unix Socket Programming Interview Questions

How to find other end of unix socket connection?

0 Answers  


How many socket connections can a server handle?

0 Answers  


Why does the sockets buffer fill up sooner than expected?

0 Answers  


What exactly does SO_KEEPALIVE do?

1 Answers  


How do I properly close a socket?

1 Answers  






Are sockets files?

0 Answers  


How do Sockets Work?

1 Answers  


How do unix sockets work?

0 Answers  


Why do we need socket programming?

0 Answers  


When should I use UDP instead of TCP?

1 Answers  


How do I send [this] over a socket?

1 Answers  


Why sockets are used?

0 Answers  


Categories