Git Product home page Git Product logo

Comments (2)

noxifoxi avatar noxifoxi commented on August 23, 2024

Can you provide a snippet of your code where the incorrect result occurs?

from minecraft-server-status.

codahq avatar codahq commented on August 23, 2024

Sure.

for ($x = 0; $x < $arrlength; $x++) {
        try {
          include_once 'MinecraftServer.php';
          $server = new MinecraftServer($servers[$x]->qhost, $servers[$x]->qport, 1);
        } catch (Exception $e) {     }

        //var_dump($server->getInfoArray());
        $online = $server && $server->online == 1 && $server->hostname;

        //generating some html here
}

There's an array of arrays ($servers) that hold the server values. Every check returns a value of online == 1 so I simply added a check for the hostname which was only populated when a server was really online. I've worked around it but I'm reporting the issue so you can fix the underlying cause if you want.

Also, as a side note, I don't know if the library or vanilla php supports more granular timeouts but the minimum 1 second is a really long time when checking local servers. I would prefer to fail out at 50ms or even 25ms so that the page can load faster. The response when the server is up will always come back in less than 1ms and never come back if it's down. Just throwing that out there in case you improve the library.

from minecraft-server-status.

Related Issues (11)

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.