/** * Opens connection to server * * @param string $Address Server ip * @param int $Port Server port * @param int $Timeout Timeout period * @param int $Engine Engine the server runs on (goldsource, source) * * @throws InvalidArgumentException * @throws SocketException */ public function Connect($Address, $Port, $Timeout = 3, $Engine = self::SOURCE) { $this->Disconnect(); if (!is_int($Timeout) || $Timeout < 0) { throw new InvalidArgumentException('Timeout must be an integer.', InvalidArgumentException::TIMEOUT_NOT_INTEGER); } $this->Socket->Open($Address, (int) $Port, $Timeout, (int) $Engine); $this->Connected = true; }