Skip to content

NetherNetLinkThread 5.46.0 ​

final class · pocketmine\network\mcpe\nethernet\NetherNetLinkThread · source

Extends Thread

Owns the loopback TCP link to the NetherNet bridge process. Frames read from the bridge are handed to the main thread (waking it up through the sleeper), and frames queued by the main thread are written to the bridge.

The listening socket stays open for the lifetime of the thread so a restarted bridge can reconnect.

Constants ​

php
public const LINK_DOWN = "\xf0"
php
public const LINK_UP = "\xf1"

Synthetic frame types delivered to the main thread (never sent on the wire).

Methods ​

__construct() ​

php
public function __construct(\pmmp\thread\ThreadSafeArray $mainToThread, \pmmp\thread\ThreadSafeArray $threadToMain, \pocketmine\snooze\SleeperHandlerEntry $sleeperEntry, string $token)

encodeFrame() ​

php
public static function encodeFrame(int $type, string $body) : string

Encodes a frame for the wire. Type is a single byte.

getThreadName() ​

php
public function getThreadName() : string

getWakePort() ​

php
public function getWakePort() : int

Loopback UDP port that wakes the thread up when the main thread queued frames.

onRun() protected ​

php
protected function onRun() : void

startAndWait() ​

php
public function startAndWait() : int

Starts the thread and returns the loopback port the bridge must connect to.

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