Server
in package
implements
ServerInterface
Interfaces, Classes, Traits and Enums
Table of Contents
- RAKLIB_TIME_PER_TICK = 1 / self::RAKLIB_TPS
- RAKLIB_TPS = 100
- $portChecking : bool
- $block : array<string|int, int>
- $ipSec : array<string|int, int>
- $logger : Logger
- $maxMtuSize : int
- $name : string
- $nextSessionId : int
- $packetLimit : int
- $rawPacketFilters : array<string|int, string>
- $receiveBytes : int
- $sendBytes : int
- $serverId : int
- $sessions : array<string|int, Session>
- $sessionsByAddress : array<string|int, Session>
- $shutdown : bool
- $socket : Socket
- $startTimeMS : int
- $ticks : int
- $unconnectedMessageHandler : UnconnectedMessageHandler
- $eventListener : ServerEventListener
- $eventSource : ServerEventSource
- $traceCleaner : ExceptionTraceCleaner
- __construct() : mixed
- addRawPacketFilter() : void
- blockAddress() : void
- closeSession() : void
- createSession() : Session
- getEventListener() : ServerEventListener
- getID() : int
- getLogger() : Logger
- getMaxMtuSize() : int
- getName() : string
- getPort() : int
- getRakNetTimeMS() : int
- Returns the time in milliseconds since server start.
- getSessionByAddress() : Session|null
- notifyACK() : void
- openSession() : void
- sendEncapsulated() : void
- sendPacket() : void
- sendRaw() : void
- sessionExists() : bool
- setName() : void
- setPacketsPerTickLimit() : void
- setPortCheck() : void
- tickProcessor() : void
- unblockAddress() : void
- waitShutdown() : void
- Disconnects all sessions and blocks until everything has been shut down properly.
- checkSessions() : void
- receivePacket() : bool
- removeSessionInternal() : void
- tick() : void
Constants
RAKLIB_TIME_PER_TICK
private
mixed
RAKLIB_TIME_PER_TICK
= 1 / self::RAKLIB_TPS
RAKLIB_TPS
private
mixed
RAKLIB_TPS
= 100
Properties
$portChecking
public
bool
$portChecking
= false
$block
protected
array<string|int, int>
$block
= []
string (address) => int (unblock time)
$ipSec
protected
array<string|int, int>
$ipSec
= []
string (address) => int (number of packets)
$logger
protected
Logger
$logger
$maxMtuSize
protected
int
$maxMtuSize
$name
protected
string
$name
= ""
$nextSessionId
protected
int
$nextSessionId
= 0
$packetLimit
protected
int
$packetLimit
= 200
$rawPacketFilters
protected
array<string|int, string>
$rawPacketFilters
= []
regex filters used to block out unwanted raw packets
$receiveBytes
protected
int
$receiveBytes
= 0
$sendBytes
protected
int
$sendBytes
= 0
$serverId
protected
int
$serverId
$sessions
protected
array<string|int, Session>
$sessions
= []
$sessionsByAddress
protected
array<string|int, Session>
$sessionsByAddress
= []
$shutdown
protected
bool
$shutdown
= false
$socket
protected
Socket
$socket
$startTimeMS
protected
int
$startTimeMS
$ticks
protected
int
$ticks
= 0
$unconnectedMessageHandler
protected
UnconnectedMessageHandler
$unconnectedMessageHandler
$eventListener
private
ServerEventListener
$eventListener
$eventSource
private
ServerEventSource
$eventSource
$traceCleaner
private
ExceptionTraceCleaner
$traceCleaner
Methods
__construct()
public
__construct(int $serverId, Logger $logger, Socket $socket, int $maxMtuSize, ProtocolAcceptor $protocolAcceptor, ServerEventSource $eventSource, ServerEventListener $eventListener, ExceptionTraceCleaner $traceCleaner) : mixed
Parameters
- $serverId : int
- $logger : Logger
- $socket : Socket
- $maxMtuSize : int
- $protocolAcceptor : ProtocolAcceptor
- $eventSource : ServerEventSource
- $eventListener : ServerEventListener
- $traceCleaner : ExceptionTraceCleaner
Return values
mixed —addRawPacketFilter()
public
addRawPacketFilter(string $regex) : void
Parameters
- $regex : string
Return values
void —blockAddress()
public
blockAddress(string $address[, int $timeout = 300 ]) : void
Parameters
- $address : string
- $timeout : int = 300
Return values
void —closeSession()
public
closeSession(int $sessionId) : void
Parameters
- $sessionId : int
Return values
void —createSession()
public
createSession(InternetAddress $address, int $clientId, int $mtuSize) : Session
Parameters
- $address : InternetAddress
- $clientId : int
- $mtuSize : int
Return values
Session —getEventListener()
public
getEventListener() : ServerEventListener
Return values
ServerEventListener —getID()
public
getID() : int
Return values
int —getLogger()
public
getLogger() : Logger
Return values
Logger —getMaxMtuSize()
public
getMaxMtuSize() : int
Return values
int —getName()
public
getName() : string
Return values
string —getPort()
public
getPort() : int
Return values
int —getRakNetTimeMS()
Returns the time in milliseconds since server start.
public
getRakNetTimeMS() : int
Return values
int —getSessionByAddress()
public
getSessionByAddress(InternetAddress $address) : Session|null
Parameters
- $address : InternetAddress
Return values
Session|null —notifyACK()
public
notifyACK(Session $session, int $identifierACK) : void
Parameters
- $session : Session
- $identifierACK : int
Return values
void —openSession()
public
openSession(Session $session) : void
Parameters
- $session : Session
Return values
void —sendEncapsulated()
public
sendEncapsulated(int $sessionId, EncapsulatedPacket $packet[, bool $immediate = false ]) : void
Parameters
- $sessionId : int
- $packet : EncapsulatedPacket
- $immediate : bool = false
Return values
void —sendPacket()
public
sendPacket(Packet $packet, InternetAddress $address) : void
Parameters
- $packet : Packet
- $address : InternetAddress
Return values
void —sendRaw()
public
sendRaw(string $address, int $port, string $payload) : void
Parameters
- $address : string
- $port : int
- $payload : string
Return values
void —sessionExists()
public
sessionExists(InternetAddress $address) : bool
Parameters
- $address : InternetAddress
Return values
bool —setName()
public
setName(string $name) : void
Parameters
- $name : string
Return values
void —setPacketsPerTickLimit()
public
setPacketsPerTickLimit(int $limit) : void
Parameters
- $limit : int
Return values
void —setPortCheck()
public
setPortCheck(bool $value) : void
Parameters
- $value : bool
Return values
void —tickProcessor()
public
tickProcessor() : void
Return values
void —unblockAddress()
public
unblockAddress(string $address) : void
Parameters
- $address : string
Return values
void —waitShutdown()
Disconnects all sessions and blocks until everything has been shut down properly.
public
waitShutdown() : void
Return values
void —checkSessions()
private
checkSessions() : void
Return values
void —receivePacket()
private
receivePacket() : bool
Tags
Return values
bool —removeSessionInternal()
private
removeSessionInternal(Session $session) : void
Parameters
- $session : Session
Return values
void —tick()
private
tick() : void