G
Guest
Hi,
I have a C# TCP client program. I want to make use of the KeepAlive
functionality to check that the connection is still alive after some time
interval. I try to use the SetSocketOption method to change the KeepAlive
interval (default is 2 hours) to be shorter, but it doesn't work. The
KeepAlive founction is activated by the SetSocketOption method, but the time
interval is still 2 hours.
This is my code:
client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive,
5000);
"client" is the socket in the client side.
I would like to ask two questions:
1. How can I change the KeepAlive time interval?
2. Can I activate the KeepAlive functionality for only one socket and other
TCP progams in the system won't be affected?
Thank you,
Ken
I have a C# TCP client program. I want to make use of the KeepAlive
functionality to check that the connection is still alive after some time
interval. I try to use the SetSocketOption method to change the KeepAlive
interval (default is 2 hours) to be shorter, but it doesn't work. The
KeepAlive founction is activated by the SetSocketOption method, but the time
interval is still 2 hours.
This is my code:
client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive,
5000);
"client" is the socket in the client side.
I would like to ask two questions:
1. How can I change the KeepAlive time interval?
2. Can I activate the KeepAlive functionality for only one socket and other
TCP progams in the system won't be affected?
Thank you,
Ken