I'm in the process of creating a Multiplayer Library in AppGameKit Studio and It already has the basic ability to handle joining and disconnecting via TCP and movement via UDP.
It can display LAN server via Broadcast and public server using a PHP Server and MySQL.
Now to remove a entry from the DB, I want to check if the Game-Server is running, if not it can be removed.
The only real problem is cleaning up the game-server list if the game-server is forced to close.
I prefer to remove entries while someone requests the list or a game-server tries to create an entry into the list.
I don't want to run a cronjob or something.
I thought I could use fsockopen but had no success.
function IsOnline( $Adress, $Port )
{
if($Socket = @fsockopen( $Adress, $Port, $ErrNo, $ErrStr, 1 ))
{
fclose( $Socket );
return true;
}
echo "Error #$errno : $errstr <br>";
return false;
}