Comments (7)
SimpleTcp server listens for any new connections on the port you specify. I'm guessing your tracker workflow is something like:
- Time to report position, wake up and establish new TCP connection to server.
- Transmit GPS coords.
- Go back to sleep.
And most likely, in step 3, the TCP connection is not being torn down in a way that SimpleTcp's socket can recognize, so at the network level, your server thinks it's still connected, just with no data / idle.
One thing you might try is to transmit something back to the connected clients every so often. Could be something as simple as a period (.) or something. That will likely cause the connections to be torn down when they can't be delivered.
Let me know if you've tried that already.
from simpletcp.
Thanks for the quick reply Brandon! Very good suggestion - I will implement it and let you know how it goes...
from simpletcp.
I have tried to do as you said
if (server.IsStarted)
server.Broadcast(new byte[] { 95 });
then ignoring the byte 95 if the byte array is 1, but the counter still goes higher
from simpletcp.
I have figured out that instead of broadcasting data, you should instead just set a timeout for each client, and let the client reconnect when needed
from simpletcp.
Hi elitefuture. If I may ask, how did you set the timeout for each client?
Thanks...
from simpletcp.
server.ClientConnected += serverJoin; //when the server is made along with DataRecieved
private void serverJoin(object sender, TcpClient e)
{
//Your server join code goes here if you have any
e.Client.ReceiveTimeout = 100;//I believe this is with ticks(1000 ticks per second), and make sure you're up to date
}
from simpletcp.
Thank you!!
from simpletcp.
Related Issues (20)
- How to communicate with specific Connected Client
- How to send a message with tcp server to the tcp client in response? HOT 1
- Simpletcp.dll requirements and dependencies --> Missing file or other libray HOT 5
- strong-name related error HOT 3
- memory leak if dont use Delimiter
- creating multiple tcp client connection and sending message to a specific server
- Closing a tcp client without causing NullReferenceExeption in SimpleTCP.dll
- Problem with UWP app
- How can I send a "200" reply to a connected client?
- server.Start(ip, Convert.ToInt32(txtPort.Text)); Null error HOT 1
- strong name missing
- targeting a specific client with a message HOT 3
- How to send Ctrl+A to the client to start session HOT 2
- I need remove - \u0013 HOT 2
- Receber mensagem como cliente
- Why you are not suggesting this item use in Prod? HOT 1
- Is it possible add timeout to .Write() function
- error can't connect to com ip System.OutOfMemoryException
- server.Stop() not close established connections
- How to send message from arduino to Simple TCP server
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 simpletcp.