Comments (14)
Hi, you may have to build a method that periodically sends a heartbeat message. I haven't found TCP keepalives to be completely reliable on all platforms, especially when there may be intermediary devices.
What OS are you using for client and server? Which framework/runtime are you using?
from supersimpletcp.
Hi, you may have to build a method that periodically sends a heartbeat message. I haven't found TCP keepalives to be completely reliable on all platforms, especially when there may be intermediary devices.
What OS are you using for client and server? Which framework/runtime are you using?
I'm using Windows for server and client. The Server is a Windows Forms App (.Net Framework 4.7.2), the Client is a WPF Application (also .Net Framework 4.7.2)
from supersimpletcp.
How often should this heartbeat method been called? I have a method on server that send all 50ms data to all clients and also a method on client site that sends all 50ms data to the server (if something changed)
from supersimpletcp.
Hi @w123u567 I would start with something around 10 seconds. An alternative would be to use Wireshark on the client and server and see if a TCP reset is being sent from one side to the other, or from an intermediary device. Cheers, Joel
from supersimpletcp.
Thank you, I will try this.
from supersimpletcp.
Wireshark shows the following output:
It seems like the server sends a TCP reset to the client, but I don't understand why.
from supersimpletcp.
I also implemented a method that sends every few seconds data (on client and on server), but nothing changed.
from supersimpletcp.
Could you try setting _server.Keepalive.EnableTcpKeepAlives = false;
and the same thing on the client, and see what happens? All of the TCP keepalive functionality is buried within the kernel - the properties I provide simply set them using the exposed APIs, and anecdotally, they aren't the most reliable.
from supersimpletcp.
Also the 'spurious retransmissions' may be of concern - it indicates that Wireshark has already seen the ACK, but perhaps the ACK was not received by the sender.
Are your client and server on the same LAN segment, i.e. there's no router in between them (other than perhaps a WiFi router)?
https://www.chappell-university.com/post/spurious-retransmissions-a-concern
from supersimpletcp.
Could you try setting
_server.Keepalive.EnableTcpKeepAlives = false;
and the same thing on the client, and see what happens? All of the TCP keepalive functionality is buried within the kernel - the properties I provide simply set them using the exposed APIs, and anecdotally, they aren't the most reliable.
I tried this and at the moment it's running since a few minutes without disconnecting. Maybe this was the solution. Also no 'spurious retransmissions' are shown in WireShark.
from supersimpletcp.
Got it. Well, let's hope that fixes the issue for you! I was tempted to leave TCP keepalives out of all of my TCP libraries since it's really like dark voodoo magic that happens under the hood, and no controls/notifications are provided when the kernel takes action. Would you mind keeping me updated on how it looks after some time? Cheers, Joel
from supersimpletcp.
Also the 'spurious retransmissions' may be of concern - it indicates that Wireshark has already seen the ACK, but perhaps the ACK was not received by the sender.
Are your client and server on the same LAN segment, i.e. there's no router in between them (other than perhaps a WiFi router)?
https://www.chappell-university.com/post/spurious-retransmissions-a-concern
If I use the client in the same Network everything was fine, only if I connect from outside of my private network (port forwarding is set correctly)
from supersimpletcp.
Got it. Well, let's hope that fixes the issue for you! I was tempted to leave TCP keepalives out of all of my TCP libraries since it's really like dark voodoo magic that happens under the hood, and no controls/notifications are provided when the kernel takes action. Would you mind keeping me updated on how it looks after some time? Cheers, Joel
Yes, I hope it will work now. I will do some tests and let you know if the problem is fixed. Thank you very much for the support :) 👍
from supersimpletcp.
No more unwanted disconnects since I set _server.Keepalive.EnableTcpKeepAlives = false;
. I will close this issue and hope for the best :)
from supersimpletcp.
Related Issues (20)
- keepalive option HOT 4
- 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
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.