Query game server

phil.svphil.sv Posts: 35Player
Can I find somewhere a wiki to know:

1) UDP query to receive players number
2) Query port

of a AAPG game server?


  • -]H[-Feertti-]H[-Feertti Posts: 12Player

    $ip = '';

    $queryport = 27020;

    $socket = @fsockopen("udp://".$ip, $queryport , $errno, $errstr, 1);

    stream_set_timeout($socket, 1);
    stream_set_blocking($socket, TRUE);
    fwrite($socket, "\xFF\xFF\xFF\xFF\x54Source Engine Query\x00");
    $response = fread($socket, 4096);

    $packet = explode("\x00", substr($response, 6), 5);
    $server = array();

    $server = $packet[0];
    $server = $packet[1];
    $server = $packet[2];
    $server = $packet[3];
    $inner = $packet[4];
    $server = ord(substr($inner, 2, 1));
    $server = ord(substr($inner, 3, 1));
    $server = ord(substr($inner, 7, 1));
    $server = ord(substr($inner, 8, 1));

    var_dump( $server );

  • phil.svphil.sv Posts: 35Player
    edited December 2018
    In fact I did not specify the language (VB.NET, not php), but I have found on Valve the right query string: "0xFF, 0xFF, 0xFF, 0xFF, 0x54, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x20, 0x45, 0x6E, 0x67, 0x69, 0x6E, 0x65, 0x20, 0x51, 0x75, 0x65, 0x72, 0x79, 0x00".

    The problem remains for the query port: 2702 is the DEFAULT value, but lots of AAPG game servers have a different value and querying the 27020 port I get socket error.
  • phil.svphil.sv Posts: 35Player
    No one here knows the possible range of ALL the available query ports?
    For servers that give SocketError on 27020 I have tried ports from 27000 to 27100 without success.
    Probably there is another settable range for the query port, completely different from 270xx.
  • Keebler750Keebler750 Posts: 3,621Beta Tester
    edited December 2018
    That 27xxx range of ports is 27000 to 27030. There are a bunch of other ports too...


    Can't remember which does what, but that's what I have open to get my server to run from home.

    This has been a test of the emergency flame-fest system. Please do not adjust your set.
Sign In or Register to comment.