當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Binary::writeShort方法代碼示例

本文整理匯總了PHP中raklib\Binary::writeShort方法的典型用法代碼示例。如果您正苦於以下問題:PHP Binary::writeShort方法的具體用法?PHP Binary::writeShort怎麽用?PHP Binary::writeShort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在raklib\Binary的用法示例。


在下文中一共展示了Binary::writeShort方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: toBinary

 /**
  * @param bool $internal
  *
  * @return string
  */
 public function toBinary($internal = false)
 {
     $binary = chr($this->reliability << 5 | ($this->hasSplit ? 0b10000 : 0));
     if ($internal) {
         $binary .= Binary::writeInt(strlen($this->buffer));
         $binary .= Binary::writeInt($this->identifierACK);
     } else {
         $binary .= Binary::writeShort(strlen($this->buffer) << 3);
     }
     if ($this->reliability === 2 or $this->reliability === 3 or $this->reliability === 4 or $this->reliability === 6 or $this->reliability === 7) {
         $binary .= Binary::writeLTriad($this->messageIndex);
     }
     if ($this->reliability === 1 or $this->reliability === 3 or $this->reliability === 4 or $this->reliability === 7) {
         $binary .= Binary::writeLTriad($this->orderIndex) . chr($this->orderChannel);
     }
     if ($this->hasSplit) {
         $binary .= Binary::writeInt($this->splitCount) . Binary::writeShort($this->splitID) . Binary::writeInt($this->splitIndex);
     }
     return $binary . $this->buffer;
 }
開發者ID:hlogeon,項目名稱:PocketMineJs-MP,代碼行數:25,代碼來源:EncapsulatedPacket.php

示例2: streamOpen

 protected function streamOpen(Session $session)
 {
     $identifier = $session->getAddress() . ":" . $session->getPort();
     $buffer = chr(RakLib::PACKET_OPEN_SESSION) . chr(strlen($identifier)) . $identifier . chr(strlen($session->getAddress())) . $session->getAddress() . Binary::writeShort($session->getPort()) . Binary::writeLong($session->getID());
     $this->server->pushThreadToMainPacket($buffer);
 }
開發者ID:PepbookPvP,項目名稱:Genisys,代碼行數:6,代碼來源:SessionManager.php

示例3: putShort

 protected function putShort($v)
 {
     $this->buffer .= Binary::writeShort($v);
 }
開發者ID:ClearSkyTeam,項目名稱:ClearSky,代碼行數:4,代碼來源:Packet.php

示例4: sendRaw

 public function sendRaw($address, $port, $payload)
 {
     $buffer = chr(RakLib::PACKET_RAW) . chr(strlen($address)) . $address . Binary::writeShort($port) . $payload;
     $this->server->pushMainToThreadPacket($buffer);
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:5,代碼來源:ServerHandler.php

示例5: toBinary

 /**
  * @param bool $internal
  *
  * @return string
  */
 public function toBinary($internal = false)
 {
     return chr($this->reliability << 5 | ($this->hasSplit ? 0b10000 : 0)) . ($internal ? Binary::writeInt(strlen($this->buffer)) . Binary::writeInt($this->identifierACK) : Binary::writeShort(strlen($this->buffer) << 3)) . ($this->reliability > 0 ? (($this->reliability >= 2 and $this->reliability !== 5) ? Binary::writeLTriad($this->messageIndex) : "") . (($this->reliability <= 4 and $this->reliability !== 2) ? Binary::writeLTriad($this->orderIndex) . chr($this->orderChannel) : "") : "") . ($this->hasSplit ? Binary::writeInt($this->splitCount) . Binary::writeShort($this->splitID) . Binary::writeInt($this->splitIndex) : "") . $this->buffer;
 }
開發者ID:ClearSkyTeam,項目名稱:ClearSky,代碼行數:9,代碼來源:EncapsulatedPacket.php

示例6: toBinary

 /**
  * @param bool $internal
  *
  * @return string
  */
 public function toBinary($internal = false)
 {
     return chr($this->reliability << 5 | ($this->hasSplit ? 0b10000 : 0)) . ($internal ? Binary::writeInt(strlen($this->buffer)) . Binary::writeInt($this->identifierACK) : Binary::writeShort(strlen($this->buffer) << 3)) . ($this->reliability > PacketReliability::UNRELIABLE ? (($this->reliability >= PacketReliability::RELIABLE and $this->reliability !== PacketReliability::UNRELIABLE_WITH_ACK_RECEIPT) ? Binary::writeLTriad($this->messageIndex) : "") . (($this->reliability <= PacketReliability::RELIABLE_SEQUENCED and $this->reliability !== PacketReliability::RELIABLE) ? Binary::writeLTriad($this->orderIndex) . chr($this->orderChannel) : "") : "") . ($this->hasSplit ? Binary::writeInt($this->splitCount) . Binary::writeShort($this->splitID) . Binary::writeInt($this->splitIndex) : "") . $this->buffer;
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:9,代碼來源:EncapsulatedPacket.php


注:本文中的raklib\Binary::writeShort方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。