1

I know there are already lot of questions on SO_REUSEADDR. Still I could not get its disdvantages and have few questions.

1]what is the danger associated with SO_REUSEADDR when we are not using any linger option.

2]Will there be any packet loss scenario?

3]What happens if i get something on the port which in time wait state?

4]What will happen to that packet which was received in TIME_WAIT?

and last but very important

5]Is there any performance impact of having lot many ports in TIME_WAIT state at any point of time?

1 Answers1

0

The disadvantage is that you might receive data that was intended for an earlier connection and not related to the new connection, corrupting that communication session. The whole point of TIME_WAIT is to allow the OS to flush out lingering data. If a packet is received for a IP/Port in TIME_WAIT state, the packet is discarded. By using SO_REUSEADDR, you bypass that safety catch.

If you have a lot of ports in TIME_WAIT state, you can cause port exhaustion, which prevents new connections from being established until ports in TIME_WAIT clear up.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • port exhaustion is very rare scenario in my case i can max have 1000 or say 2000 connection. but say if i have 100-200 port in time wait state. will it make any impact on performance. since in this case i will be TCP control block for each port which is in time wait state. my concern is , will that effect be a considerable one? –  Nov 06 '14 at 07:22