Comments (4)
Hi @jwj15 so sorry for taking so long to get back to you on this. Looking at it now.
from supersimpletcp.
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.
from supersimpletcp.
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.
from supersimpletcp.
@jchristn I am also having the same problem.
It works fine on Windows 10.
But, If a client using the 'TcpKeepAliveRetryCount' option is Executed on Windows 7, an exception message "keepalives not supported on this platform, disabled" is output and the function is immediately disconnected.
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.
So it seems that the problem occurs in versions such as Windows 7 or windows10 enterprise ltsb 2016.
See link below.
- https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options#windows-support-for-ipproto_tcp-options:~:text=x-,TCP_KEEPCNT,Starting%20with%20Windows%C2%A010%2C%20version%201703,-TCP_MAXRT
- https://en.wikipedia.org/wiki/Windows_10,_version_1703
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
from supersimpletcp.
Related Issues (20)
- Message Framing Question HOT 1
- Send(); fails on Windows 8/8.1 HOT 2
- SimpleTcpServer DataReceived method spawns a new task for each DataReceived event HOT 3
- receive data not fast after connect HOT 1
- Server.IsListening wrong behavior when MaxConnections reached HOT 1
- Client connection is lost with no obvious reason HOT 10
- how to include dll file in exe file to be a one exe file ?? HOT 1
- NoDelay option for listener HOT 1
- KeepAliveSettings for server are applied in seconds on connecting client instead of ms HOT 1
- An active client with keep alive that does not process incoming message leads memory buildup in the server HOT 1
- What metadata is being embeded when the data is send in chunks? HOT 1
- SimpleTcpClient.Events.Disconnected is not triggered when SimpleTcpServer.Close() is invoked. HOT 1
- Block Unwanted Participants HOT 1
- multiple IP address HOT 2
- Keep Alive in linux container HOT 1
- The server sends messages to all clients on a regular basis HOT 2
- The client connecting to the Server on Maui is immediately kicked out. HOT 17
- About _Server.Stop() HOT 5
- supersimpletcp is missing NuGet package README file
- Why doesn't Dispose call Stop? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from supersimpletcp.