So, I'm designing a project page for a gCn program, and I wanted to, on the page, indicate the online status of the bridge. And have some sort of colored dot, where green is online and good, orange is online but lagging, and red is offline or error. I'm trying to do this in PHP. I came across the fsockopen() call.

function check_gCnBridgeActive () {
   $host = "";
   $port = "8888";
   $conn = fsockopen( $host, $port);

Now, what do I do from there to send a packet and test for a certain packet back? Basically I want to send a packet out with just a type byte, and receive back a 8-byte packet (2-byte bridge version, 3-byte latest client version, 3-byte earlier supported client).
If you're asking for how to send and receive packets on a PHP socket connection, Google has some good answers. You can use something like microtime() (please don't copy-paste that code exactly, as it's not quite what you want) to determine how long it takes to get a response to your message.
Ok, so i did this:


$start = microtime(true);
$end = microtime(true);
$time = $end - $start;

now, what response time would constitute a lagging server? and what step function could i use to determine how badly the server is lagging?
bumpity bump.

Also, to create a GUI for server configuration with log in for server admins, i took to my first attempt at using MySQL, and did it successfully. I've now started setting up databases for the Star Trek gCn server.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum