Пример #1
0
 /**
  * Send a Server List Ping request
  * 
  * @param resource $fp Handle to an open socket
  * @throws \Exception
  */
 private function sendRequest($fp)
 {
     $req = array(chr(0), self::packVarInt(47), self::packString($this->gs->getHostname()), pack('n', $this->gs->getPort()), self::packVarInt(1));
     $req = self::packString(implode('', $req));
     fwrite($fp, $req);
     $req = self::packString(chr(0));
     fwrite($fp, $req);
 }
 /**
  * Send a Server List Ping request to the server
  * 
  * @param resource $fp Handle to an open socket
  */
 private function sendRequest($fp)
 {
     $req = pack('nc', 0xfe01, 0xfa);
     $req .= self::packUTF16BEString('MC|PingHost');
     $req .= pack('nc', 7 + 2 * strlen($this->gs->getHostname()), 73);
     $req .= self::packUTF16BEString($this->gs->getHostname());
     $req .= pack('N', $this->gs->getPort());
     fwrite($fp, $req);
 }