TcpClient.LingerState not working (still in TIME_WAIT)

  • Thread starter Thread starter Amil
  • Start date Start date
A

Amil

By default, when I close a TcpClient connection, the network state
goes to TIME_WAIT for a few minutes. This is to be expected. I
want to be able to reconnect on the same IP/port again quickly.

So, I set my socket as:

TcpClient c = new TcpClient(mylocalendpoint);
c.LingerState.Enabled = false;
c.LingerState.LingerTime = 0;
c.Connect(remoteendpoint);
....
c.Close();

But, when I disconnect, the network state is still in TIME_WAIT.

Any ideas?

Amil
 
Back
Top