OpenGSQ PHP

ProtocolBase
in package

AbstractYes

Class ProtocolBase

This abstract class serves as a base for all protocol classes. It provides basic properties and methods that are common to all protocols.

Table of Contents

Properties

$host  : string
$port  : int
$timeout  : int

Methods

__construct()  : mixed
Initializes a new instance of the ProtocolBase class.
getIPAddress()  : string
Gets the Internet Protocol (IP) endpoint.
readNullString()  : string
Reads a null-padded string from the binary data string.
readUInt16()  : int
Reads an unsigned 16-bit integer from the binary data string.
readUInt32()  : int
Reads an unsigned 32-bit integer from the binary data string.

Properties

$timeout

public int $timeout

The timeout for the connection in seconds.

Methods

__construct()

Initializes a new instance of the ProtocolBase class.

public __construct(string $host, int $port[, int $timeout = 5 ]) : mixed
Parameters
$host : string

The host to connect to.

$port : int

The port to connect to.

$timeout : int = 5

The timeout for the connection in seconds. Default is 5 seconds.

getIPAddress()

Gets the Internet Protocol (IP) endpoint.

protected getIPAddress() : string
Return values
string

The IP address of the host.

readNullString()

Reads a null-padded string from the binary data string.

protected readNullString(string &$data) : string
Parameters
$data : string

The binary data string. This parameter is passed by reference, and the function will modify it by removing the read bytes.

Return values
string

The null-padded string read from the binary data string.

readUInt16()

Reads an unsigned 16-bit integer from the binary data string.

protected readUInt16(string &$data) : int
Parameters
$data : string

The binary data string. This parameter is passed by reference, and the function will modify it by removing the read bytes.

Return values
int

The unsigned 16-bit integer read from the binary data string.

readUInt32()

Reads an unsigned 32-bit integer from the binary data string.

protected readUInt32(string &$data) : int
Parameters
$data : string

The binary data string. This parameter is passed by reference, and the function will modify it by removing the read bytes.

Return values
int

The unsigned 32-bit integer read from the binary data string.


        
On this page

Search results