SuperSimpleTcp icon indicating copy to clipboard operation
SuperSimpleTcp copied to clipboard

keepalive option

Open jwj15 opened this issue 1 year ago • 4 comments

#152 I found a solution to this problem https://github.com/jchristn/SuperSimpleTcp/blob/52ba8d1aaea486a9599ac71e2aab3de7e8df1041/src/SuperSimpleTcp/SimpleTcpClient.cs#L1082

Only that option has an error in Windows 7

I suggest removing this option from win7

// win10 or later
if (Environment.OSVersion.Version.Major >= 10)
{
    _client.Client.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveRetryCount, _keepalive.TcpKeepAliveRetryCount); 
}

or

// win7 later
if (Environment.OSVersion.Version.Major + Environment.OSVersion.Version.Minor * 0.1 > 6.1)
{
    _client.Client.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveRetryCount, _keepalive.TcpKeepAliveRetryCount); 
}

jwj15 avatar Sep 07 '22 01:09 jwj15

Hi @jwj15 so sorry for taking so long to get back to you on this. Looking at it now.

jchristn avatar Sep 14 '22 21:09 jchristn

Looks like we'll also have to employ RuntimeInformation.IsOSPlatform (see https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.runtimeinformation.isosplatform?view=net-6.0) and apply the version major/minor check only against those that are running Windows.

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.

jchristn avatar Sep 14 '22 22:09 jchristn

I'm not sure if it's a Windows version issue. same symptom occurred in windows10 enterprise ltsb 2016. In my case, only TcpKeepAliveRetryCount was the problem. I am using the version with only that option removed in my work environment. FYI, I work on pos and kiosk industry.

jwj15 avatar Sep 21 '22 01:09 jwj15