-
Notifications
You must be signed in to change notification settings - Fork 28
NFSU Server Status
HarpyWar edited this page Jan 12, 2021
·
3 revisions
Connection to TCP port 10980 will return a server status info like this:
usercount|roomcount|timeonlineinseconds|platform|version|servername~~~A.LAN|0|[]B.LAN|0|[]C.LAN|0|[]D.LAN|0|[HarpyWar|]E.LAN|1|[|]F.LAN|0|[]G.LAN|0|[]H.LAN|0|[]
A.LAN|0|[]B.LAN|0|...
are room names with count of users inside, and usernames with comma delimeter inside brackets.
Basic PHP example:
<?php
$address = '87.228.3.174';
$port = 10980;
echo get_nfsu_data($address, $port);
function get_nfsu_data($address, $port)
{
$output = "";
if ( ($socket = socket_create(AF_INET, SOCK_STREAM, 0)) && socket_connect($socket, $address, $port) )
{
while ($tmp = socket_read($socket, 4024))
$output .= $tmp;
socket_close ($socket);
}
return $output;
}
?>