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; } } }
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."); } }
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"); } }
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("Сервер недоступен."); } }
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."); } }
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; } }