I have problem on my client, I have for some reason zombie connections, which I would like to understand why and how to handle it better on my code.
For some reason my client thinks he is connected to the server (TcpListener), while the server is down.
I checked on TcpView (on the client machine) and the connection is "ESTABLISHED", while on the server there is no connection.
It's might be worth mentioning that my client is creating 400~ tcp connections to different servers
How can I handle this on my client side? some configuration on the machine? on my code?
When one side of a TCP connection dies the other side is not notified. TCP by default does not perform any keep alive checking either.
Probably, you should modify your application protocol to be resilient to dead connections (timeouts) and to perform periodic keep alive check round-trips.
Alternatively, I think you can enable keep-alive checks per connection.
All that a keep alive does is shorten the duration that it takes to detect the failure. It does not ensure that the connection is healthy.