I'm using unpack to process a reply from the Goldsource (Half-Life) master servers. The reply is a list a 6 byte header followed by IP addresses made up of 6 bytes each.
The reply is in the format:
The unsigned short is network ordered, or supposedly big endian.
More information here: http://developer.valvesoftware.com/w...Query_Protocol
I'm using this to unpack it and display the IP addresses:
The IP address itself is displayed correctly, but the port number is always 105! Any ideas why?Code:$outData = unpack("C*/C*/C*/C*/n*", $out); for ($i = 1; $i<=sizeof($outData); $i+=6) echo $outData[$i] . "." . $outData[$i+1] . "." . $outData[$i+2] . "." . $outData[$i+3] . ":" . $outData[$i+4] . "<br />";