15declare(strict_types=1);
17namespace raklib\protocol;
28 public array $systemAddresses = [];
29 public int $sendPingTime;
30 public int $sendPongTime;
35 public static function create(
InternetAddress $clientAddress, array $systemAddresses,
int $sendPingTime,
int $sendPongTime) : self{
37 $result->address = $clientAddress;
38 $result->systemAddresses = $systemAddresses;
39 $result->sendPingTime = $sendPingTime;
40 $result->sendPongTime = $sendPongTime;
44 public function __construct(){
48 protected function encodePayload(PacketSerializer $out) : void{
49 $out->putAddress($this->address);
52 $dummy =
new InternetAddress(
"0.0.0.0", 0, 4);
54 $out->putAddress($this->systemAddresses[$i] ?? $dummy);
57 $out->putLong($this->sendPingTime);
58 $out->putLong($this->sendPongTime);
62 $this->address = $in->getAddress();
65 $len = strlen($in->getBuffer());
68 for($i = 0; $i < RakLib::$SYSTEM_ADDRESS_COUNT; ++$i){
69 $this->systemAddresses[$i] = $in->getOffset() + 16 < $len ? $in->
getAddress() : $dummy;
72 $this->sendPingTime = $in->
getLong();
73 $this->sendPongTime = $in->
getLong();
static int $SYSTEM_ADDRESS_COUNT
decodePayload(PacketSerializer $in)
static create(InternetAddress $clientAddress, array $systemAddresses, int $sendPingTime, int $sendPongTime)
const ID_CONNECTION_REQUEST_ACCEPTED
RakPeer - In a client/server environment, our connection request to the server has been accepted.