Skip to content

RelayedServerSocket 5.46.0 ​

class · pocketmine\network\mcpe\raklib\RelayedServerSocket · source

Extends raklib\server\ServerSocket

RakLib socket used when the NetherNet bridge owns the server's UDP port and shares it with RakNet: the bridge keeps WebRTC datagrams for itself and relays every other datagram (RakNet, Query) to this loopback socket with the real address of the sender, and sends what RakLib writes out of the shared port. RakLib sees real client addresses, so sessions, bans and rate limits work as usual.

Datagram format (both ways): u8 type. DATA (0x00): u8 IP version (4 or 6), IP address (4 or 16 bytes), u16 port, payload. HELLO (0x01, bridge -> RakLib only): token, sent periodically so RakLib learns (again, after a restart of the bridge) which loopback port the bridge sends from. Datagrams from any other port are ignored.

Methods ​

__construct() ​

php
public function __construct(\raklib\utils\InternetAddress $publicAddress, string $token)

disableBroadcast() ​

php
public function disableBroadcast() : bool

enableBroadcast() ​

php
public function enableBroadcast() : bool

getBindAddress() ​

php
public function getBindAddress() : \raklib\utils\InternetAddress

getRelayPort() ​

php
public function getRelayPort() : int

Loopback port the bridge must relay RakNet datagrams to.

readPacket() ​

php
public function readPacket(?string &$source, ?int &$port) : ?string

writePacket() ​

php
public function writePacket(string $buffer, string $dest, int $port) : int

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.