-
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keepalive option #153
Comments
Hi @jwj15 so sorry for taking so long to get back to you on this. Looking at it now. |
Looks like we'll also have to employ Is it only the TcpKeepAliveRetryCount that is problematic? How about the others? This will have to be implemented in a way that doesn't create problems when using some Linux variant that has what appears to be a version number equal to or less than Windows 7. |
I'm not sure if it's a Windows version issue. |
@jchristn I am also having the same problem. Like the solution of @jwj15, 'TcpKeepAliveRetryCount' is applied only in Windows 10 version 1703 or later, and if applied before that, an exception seems to occur. See link below.
After applying the code below to the Local Clone Repo, the built dll was applied, and it was confirmed that it was built on Windows 7. private void EnableKeepalives()
{
// issues with definitions: https://github.com/dotnet/sdk/issues/14540
try
{
#if NETCOREAPP3_1_OR_GREATER || NET6_0_OR_GREATER
// NETCOREAPP3_1_OR_GREATER catches .NET 5.0
_client.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);
_client.Client.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveTime, _keepalive.TcpKeepAliveTime);
_client.Client.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveInterval, _keepalive.TcpKeepAliveInterval);
// Windows 10 version 1703 or later
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
&& Environment.OSVersion.Version >= new Version(10, 0, 15063))
{
_client.Client.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveRetryCount, _keepalive.TcpKeepAliveRetryCount);
}
#elif NETFRAMEWORK |
#152
I found a solution to this problem
SuperSimpleTcp/src/SuperSimpleTcp/SimpleTcpClient.cs
Line 1082 in 52ba8d1
Only that option has an error in Windows 7
I suggest removing this option from win7
or
The text was updated successfully, but these errors were encountered: