pocketmine\network\rcon\RCON::__construct PHP Method

__construct() public method

public __construct ( Server $server, $password, $port = 19132, $interface = "0.0.0.0", $threads = 1, $clientsPerThread = 50 )
$server pocketmine\Server
    public function __construct(Server $server, $password, $port = 19132, $interface = "0.0.0.0", $threads = 1, $clientsPerThread = 50)
    {
        $this->server = $server;
        $this->workers = [];
        $this->password = (string) $password;
        $this->server->getLogger()->info("Starting remote control listener");
        if ($this->password === "") {
            $this->server->getLogger()->critical("RCON can't be started: Empty password");
            return;
        }
        $this->threads = (int) max(1, $threads);
        $this->clientsPerThread = (int) max(1, $clientsPerThread);
        $this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
        if ($this->socket === false or !socket_bind($this->socket, $interface, (int) $port) or !socket_listen($this->socket)) {
            $this->server->getLogger()->critical("RCON can't be started: " . socket_strerror(socket_last_error()));
            $this->threads = 0;
            return;
        }
        socket_set_block($this->socket);
        for ($n = 0; $n < $this->threads; ++$n) {
            $this->workers[$n] = new RCONInstance($this->server->getLogger(), $this->socket, $this->password, $this->clientsPerThread);
        }
        socket_getsockname($this->socket, $addr, $port);
        $this->server->getLogger()->info("RCON running on {$addr}:{$port}");
    }