PHP Класс Network\Socket

Event driven I/O.
Наследование: extends XPSPL\SIG_Routine
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$default_wait_time integer Default socket wait time in seconds.

Защищенные свойства (Protected)

Свойство Тип Описание
$_address string Socket Address
$_clients array Client sockets currently connected for read/write.
$_connection object Socket connection object
$_options Options used for the socket.

Открытые методы

Метод Описание
__construct ( string $address, string $options = [] ) : void Constructs a new socket.
get_connections ( ) : array Returns the currently connected clients.
on_connect ( callable $function ) : object Registers a new handle for new client connections.
on_disconnect ( callable $function ) : object Registers a new handle for disconnections.
on_error ( callable $function ) : object Registers a new handle for socket connection errors.
on_read ( callable $function ) : object Registers a new handle for client read.
on_write ( callable $function ) : object Registers a new handle for client write.
reconnect ( ) : void Reconnects the socket.
routine ( Routine $routine ) : void Registers the idle process.

Защищенные методы

Метод Описание
_connect ( ) : void Establishes the socket connection.

Описание методов

__construct() публичный Метод

Constructs a new socket.
public __construct ( string $address, string $options = [] ) : void
$address string Address to make the connection on.
$options string Connection options
Результат void

_connect() защищенный Метод

Establishes the socket connection.
protected _connect ( ) : void
Результат void

get_connections() публичный Метод

Returns the currently connected clients.
public get_connections ( ) : array
Результат array

on_connect() публичный Метод

Registers a new handle for new client connections.
public on_connect ( callable $function ) : object
$function callable Function to call on connect.
Результат object

on_disconnect() публичный Метод

Registers a new handle for disconnections.
public on_disconnect ( callable $function ) : object
$function callable Function to call on connect.
Результат object

on_error() публичный Метод

Registers a new handle for socket connection errors.
public on_error ( callable $function ) : object
$function callable Function to call on errors.
Результат object

on_read() публичный Метод

Registers a new handle for client read.
public on_read ( callable $function ) : object
$function callable Function to call on connect.
Результат object

on_write() публичный Метод

Registers a new handle for client write.
public on_write ( callable $function ) : object
$function callable Function to call on connect.
Результат object

reconnect() публичный Метод

It will attempt to close before reconnecting.
public reconnect ( ) : void
Результат void

routine() публичный Метод

Registers the idle process.
public routine ( Routine $routine ) : void
$routine XPSPL\Routine
Результат void

Описание свойств

$_address защищенное свойство

Socket Address
protected string $_address
Результат string

$_clients защищенное свойство

Client sockets currently connected for read/write.
protected array $_clients
Результат array

$_connection защищенное свойство

Socket connection object
protected object $_connection
Результат object

$_options защищенное свойство

Options used for the socket.
protected $_options

$default_wait_time публичное свойство

Default socket wait time in seconds.
public int $default_wait_time
Результат integer