View Full Version : Gameserver Tracking

03-19-2009, 05: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 = "";
$port = "27015";
$fp=pfsockopen("udp://".$ip."", $port, $num, $error, 5);
if (!$fp){
echo '<B><FONT COLOR=red>Offline</b></FONT>';
echo '<B><FONT COLOR=lime>Online</b></FONT>';


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

Anyone know the issue here?

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


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.

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

fget command? or something similar?

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

03-19-2009, 06: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