...

View Full Version : Gameserver Tracking



Killermud
03-19-2009, 06:20 PM
Im trying to get contact with gameservers using the fopensock() command, but in order to contact gameservers the ip address prefix needs to start with udp://ipaddress. But the problem im having is it always thinks the inputted ip address is always true although i've tried having an ip address which does not represent anything and it still thinks it is online.

heres my code :



<?
$ip = "195.8.208.32";
$port = "27015";
$fp=pfsockopen("udp://".$ip."", $port, $num, $error, 5);
if (!$fp){
echo '<B><FONT COLOR=red>Offline</b></FONT>';
}else{
echo '<B><FONT COLOR=lime>Online</b></FONT>';
fclose($fp);
}

?>

so whatever i put in the ip address i put in it displays Online.

Anyone know the issue here?

tomws
03-19-2009, 06:52 PM
PErhaps useful info from the man page:

Warning

UDP sockets will sometimes appear to have opened without an error, even if the remote host is unreachable. The error will only become apparent when you read or write data to/from the socket. The reason for this is because UDP is a "connectionless" protocol, which means that the operating system does not try to establish a link for the socket until it actually needs to send or receive data.

Killermud
03-19-2009, 07:23 PM
So what can i do to make it recieve data?

fget command? or something similar?

Hayyel
03-19-2009, 07:31 PM
Could ping it. Once every so many minutes.

tomws
03-19-2009, 07:38 PM
So what can i do to make it recieve data?

fget command? or something similar?

Don't know. Never used it. But I can read the man page, and from the examples and comments, that looks right. Maybe fgets() or fread()?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum