Giter Club home page Giter Club logo

Comments (7)

BrandonPotter avatar BrandonPotter commented on September 13, 2024

SimpleTcp server listens for any new connections on the port you specify. I'm guessing your tracker workflow is something like:

  1. Time to report position, wake up and establish new TCP connection to server.
  2. Transmit GPS coords.
  3. 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.

fabs-rodriguez avatar fabs-rodriguez commented on September 13, 2024

Thanks for the quick reply Brandon! Very good suggestion - I will implement it and let you know how it goes...

from simpletcp.

elitefuture avatar elitefuture commented on September 13, 2024

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.

elitefuture avatar elitefuture commented on September 13, 2024

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.

fabs-rodriguez avatar fabs-rodriguez commented on September 13, 2024

Hi elitefuture. If I may ask, how did you set the timeout for each client?
Thanks...

from simpletcp.

elitefuture avatar elitefuture commented on September 13, 2024

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.

fabs-rodriguez avatar fabs-rodriguez commented on September 13, 2024

Thank you!!

from simpletcp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.