public function getServers($regionCode = MasterServer::REGION_ALL , $filter = '', $force = false) {
        $failCount   = 0;
        $finished    = false;
        $portNumber  = 0;
        $hostName    = '0.0.0.0';
        $serverArray = [];

        while(true) {
            $failCount = 0;
            try {
                do {
                    $this->socket->send(new A2MGETSERVERSBATCH2Packet($regionCode, "$hostName:$portNumber", $filter));
                    try {
                        $serverStringArray = $this->socket->getReply()->getServers();

                        foreach($serverStringArray as $serverString) {
                            $serverString = explode(':', $serverString);
                            $hostName = $serverString[0];
                            $portNumber = $serverString[1];

                            if($hostName != '0.0.0.0' && $portNumber != 0) {
                                $serverArray[] = [$hostName, $portNumber];
                            } else {
                                $finished = true;
                            }
                        }
                        $failCount = 0;
                    } catch(TimeoutException $e) {
                        $failCount ++;
                        if($failCount == self::$retries) {
                            throw $e;
                        }
                        $this->logger->info("Request to master server {$this->ipAddress} timed out, retrying...");
                    }
                } while(!$finished);
                break;
            } catch(TimeoutException $e) {
                if ($this->rotateIp()) {
                    if ($force) {
                        break;
                    }
                    throw $e;
                }
                $this->logger->info("Request to master server failed, retrying {$this->ipAddress}...");
            }
        }

        return array_unique($serverArray, SORT_REGULAR);
    }
public function getServers($regionCode = MasterServer::REGION_ALL , $filter = '', $force = false) {
        $failCount   = 0;
        $finished    = false;
        $portNumber  = 0;
        $hostName    = '0.0.0.0';
        $serverArray = [];

        while(true) {
            $failCount = 0;
            try {
                do {
                    $this->socket->send(new A2MGETSERVERSBATCH2Packet($regionCode, "$hostName:$portNumber", $filter));
                    try {
                        $serverStringArray = $this->socket->getReply()->getServers();

                        foreach($serverStringArray as $serverString) {
                            $serverString = explode(':', $serverString);
                            $hostName = $serverString[0];
                            $portNumber = $serverString[1];

                            if($hostName != '0.0.0.0' && $portNumber != 0) {
                                $serverArray[] = [$hostName, $portNumber];
                            } else {
                                $finished = true;
                            }
                        }
                        $failCount = 0;
                    } catch(TimeoutException $e) {
                        $failCount ++;
                        if($failCount == self::$retries) {
                            throw $e;
                        }
                        $this->logger->info("Request to master server {$this->ipAddress} timed out, retrying...");
                    }
                } while(!$finished);
                break;
            } catch(TimeoutException $e) {
                if ($this->rotateIp()) {
                    if ($force) {
                        break;
                    }
                    throw $e;
                }
                $this->logger->info("Request to master server failed, retrying {$this->ipAddress}...");
            }
        }

        return array_unique($serverArray, SORT_REGULAR);
    }
public function getServers ( $ regionCode = MasterServer :: REGION_ALL , $ filter = '' , $ force = false ) { $ failCount = 0 ; $ finished = false ; $ portNumber = 0 ; $ hostName = '0.0.0.0' ; $ serverArray = [ ] ; while ( true ) { $ failCount = 0 ; try { do { $ this -> socket -> send ( new A2MGETSERVERSBATCH2Packet ( $ regionCode , "$hostName:$portNumber" , $ filter ) ) ; try { $ serverStringArray = $ this -> socket -> getReply ( ) -> getServers ( ) ; foreach ( $ serverStringArray as $ serverString ) { $ serverString = explode ( ':' , $ serverString ) ; $ hostName = $ serverString [ 0 ] ; $ portNumber = $ serverString [ 1 ] ; if ( $ hostName != '0.0.0.0' && $ portNumber != 0 ) { $ serverArray [ ] = [ $ hostName , $ portNumber ] ; } else { $ finished = true ; } } $ failCount = 0 ; } catch ( TimeoutException $ e ) { $ failCount ++ ; if ( $ failCount == self :: $ retries ) { throw $ e ; } $ this -> logger -> info ( "Request to master server {$this->ipAddress} timed out, retrying..." ) ; } } while ( ! $ finished ) ; break ; } catch ( TimeoutException $ e ) { if ( $ this -> rotateIp ( ) ) { if ( $ force ) { break ; } throw $ e ; } $ this -> logger -> info ( "Request to master server failed, retrying {$this->ipAddress}..." ) ; } } return array_unique ( $ serverArray , SORT_REGULAR ) ; }
Returns a list of game server matching the given region and filters

Filtering:
Instead of filtering the results sent by the master server locally, you
should at least use the following filters to narrow down the results
sent by the master server.

<b>Note:</b> Receiving all servers from the master server is taking
quite some time.

Available filters:

<ul>
<li><var>\type\d</var>: Request only dedicated servers
<li><var>\secure\1</var>: Request only secure servers
<li><var>\gamedir\[mod]</var>: Request only servers of a specific mod
<li><var>\map\[mapname]</var>: Request only servers running a specific
map
<li><var>\linux\1</var>: Request only linux servers
<li><var>\emtpy\1</var>: Request only **non**-empty servers
<li><var>\full\1</var>: Request only servers **not** full
<li><var>\proxy\1</var>: Request only spectator proxy servers
</ul>

@param int $regionCode The region code to specify a location of the
game servers
@param string $filter The filters that game servers should match
@param bool $force Return a list of servers even if an error occured
while fetching them from the master server
@return array A list of game servers matching the given
region and filters
@see setTimeout()
@see A2M_GET_SERVERS_BATCH2_Packet
@throws SteamCondenserException if a problem occurs while parsing the
reply
@throws TimeoutException if too many timeouts occur while querying the
master server
Returns a list of game server matching the given region and filters