How to set KeepAlive flag in C#

Let’s see how we can set the KeepAlive flag in TcpClient.

TcpClient client = ... ;
client.Client.SetSocketOption(SocketOptionLevel.Socket, 
                SocketOptionName.KeepAlive, true);
Categories: C# Tags: , ,
%d bloggers like this: