コード例 #1
0
 public function Connect($Ip, $Port = 25575, $Password, $Timeout = 3)
 {
     $this->RequestId = 0;
     if ($this->Socket = FSockOpen($Ip, (int) $Port)) {
         Socket_Set_TimeOut($this->Socket, $Timeout);
         if (!$this->Auth($Password)) {
             $this->Disconnect();
         } else {
             return true;
         }
     }
 }
コード例 #2
0
 public function Connect($Ip, $Port = 25575, $Password, $Timeout = 3)
 {
     $this->RequestId = 0;
     if ($this->Socket = @FSockOpen($Ip, (int) $Port)) {
         Socket_Set_TimeOut($this->Socket, $Timeout);
         if (!$this->Auth($Password)) {
             $this->Disconnect();
             throw new MinecraftRconException("Authorization failed, password is wrong.");
         }
     } else {
         throw new MinecraftRconException("Can`t connect to MC server.");
     }
 }
コード例 #3
0
ファイル: rcon.class.php プロジェクト: qexyorg/webMCR-1
 public function Connect($Ip, $Port = 25575, $Password, $Timeout = 3)
 {
     $this->RequestId = 0;
     if ($this->Socket = @FSockOpen($Ip, (int) $Port, $errno, $errstr, $Timeout)) {
         Socket_Set_TimeOut($this->Socket, $Timeout);
         if (!$this->Auth($Password)) {
             $this->Disconnect();
             throw new MinecraftRconException("Authorization failed.");
         }
     } else {
         throw new MinecraftRconException("Server offline");
     }
 }
コード例 #4
0
 public function Connect($Ip, $Port = 25575, $Password, $Timeout = 3)
 {
     $this->RequestId = 0;
     if ($this->Socket == FSockOpen($Ip, (int) $Port)) {
         Socket_Set_TimeOut($this->Socket, $Timeout);
         if (!$this->Auth($Password)) {
             $this->Disconnect();
             throw new MinecraftRconException("Неудалось авторизироваться.");
         }
     } else {
         throw new MinecraftRconException("Сервер недоступен.");
     }
 }
コード例 #5
0
 public function Connect($Ip, $Port = 25575, $Password, $Timeout = 3)
 {
     $this->RequestId = 0;
     if ($this->Socket = FSockOpen($Ip, (int) $Port)) {
         Socket_Set_TimeOut($this->Socket, $Timeout);
         if (!$this->Auth($Password)) {
             $this->Disconnect();
             throw new MinecraftRconException("Authorization failed.");
         }
     } else {
         throw new MinecraftQueryException("Can't open socket.");
     }
 }
コード例 #6
0
 public function Connect($Ip, $Port = 25565, $Timeout = 3)
 {
     if ($this->Socket = FSockOpen('udp://' . $Ip, (int) $Port)) {
         Socket_Set_TimeOut($this->Socket, $Timeout);
         $Challenge = $this->GetChallenge();
         if ($Challenge === false) {
             FClose($this->Socket);
             return false;
         }
         if (!$this->GetStatus($Challenge)) {
             FClose($this->Socket);
             return false;
         }
         FClose($this->Socket);
         return true;
     } else {
         return false;
     }
 }