public function send(RCONPacket $dataPacket)
 {
     if (empty($this->socket)) {
         $this->socket = new TCPSocket();
         $this->socket->connect($this->ipAddress, $this->portNumber);
     }
     $this->socket->send($dataPacket->__toString());
 }
Example #2
0
 public function send(RCONPacket $dataPacket)
 {
     if (!$this->channel->isConnected()) {
         $this->channel->connect($this->remoteSocket[0], $this->remoteSocket[1]);
     }
     $this->buffer = ByteBuffer::wrap($dataPacket->getBytes());
     $this->channel->write($this->buffer);
 }
 /**
  * Creates a RCON command execution request for the given request ID and
  * command
  *
  * @param int $requestId The request ID of the RCON connection
  * @param string $command The command to execute on the server
  */
 public function __construct($requestId, $command)
 {
     parent::__construct($requestId, RCONPacket::SERVERDATA_EXECCOMMAND, $command);
 }
 public function __construct($requestId)
 {
     parent::__construct($requestId, RCONPacket::SERVERDATA_AUTH_RESPONSE);
 }
 /**
  * Creates a RCON command response for the given request ID and command
  * output
  *
  * @param int $requestId The request ID of the RCON connection
  * @param string $commandResponse The output of the command executed on the
  *        server
  */
 public function __construct($requestId, $commandResponse)
 {
     parent::__construct($requestId, RCONPacket::SERVERDATA_RESPONSE_VALUE, $commandResponse);
 }
 public function __construct($requestId, $password)
 {
     parent::__construct($requestId, RCONPacket::SERVERDATA_AUTH, $password);
 }