Unix Socket Programming Question:
Download Job Interview Questions and Answers PDF
Explain the TIME_WAIT state.
![Unix Socket Programming Interview Answer Unix Socket Programming Interview Question](https://globalguideline.com/public/images/interview/5.webp)
Answer:
Remember that TCP guarantees all data transmitted will be delivered, if at all possible. When you close a socket, the server goes into a TIME_WAIT state, just to be really really sure that all the data has gone through. When a socket is closed, both sides agree by sending messages to each other that they will send no more data. This, it seemed to me was good enough, and after the handshaking is done, the socket should be closed. The problem is two-fold. First, there is no way to be sure that the last ack was communicated successfully. Second, there may be "wandering duplicates" left on the net that must be dealt with if they are delivered.
Download Unix Socket Programming Interview Questions And Answers
PDF
Previous Question | Next Question |
What is the difference between close() and shutdown()? | How can I put a timeout on connect()? |