PHP Class Network\Socket

Event driven I/O.
Inheritance: extends XPSPL\SIG_Routine
Afficher le fichier Open project: prggmr/xpspl

Méthodes publiques

Свойство Type Description
$default_wait_time integer Default socket wait time in seconds.

Protected Properties

Свойство Type Description
$_address string Socket Address
$_clients array Client sockets currently connected for read/write.
$_connection object Socket connection object
$_options Options used for the socket.

Méthodes publiques

Méthode Description
__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.

Méthodes protégées

Méthode Description
_connect ( ) : void Establishes the socket connection.

Method Details

__construct() public méthode

Constructs a new socket.
public __construct ( string $address, string $options = [] ) : void
$address string Address to make the connection on.
$options string Connection options
Résultat void

_connect() protected méthode

Establishes the socket connection.
protected _connect ( ) : void
Résultat void

get_connections() public méthode

Returns the currently connected clients.
public get_connections ( ) : array
Résultat array

on_connect() public méthode

Registers a new handle for new client connections.
public on_connect ( callable $function ) : object
$function callable Function to call on connect.
Résultat object

on_disconnect() public méthode

Registers a new handle for disconnections.
public on_disconnect ( callable $function ) : object
$function callable Function to call on connect.
Résultat object

on_error() public méthode

Registers a new handle for socket connection errors.
public on_error ( callable $function ) : object
$function callable Function to call on errors.
Résultat object

on_read() public méthode

Registers a new handle for client read.
public on_read ( callable $function ) : object
$function callable Function to call on connect.
Résultat object

on_write() public méthode

Registers a new handle for client write.
public on_write ( callable $function ) : object
$function callable Function to call on connect.
Résultat object

reconnect() public méthode

It will attempt to close before reconnecting.
public reconnect ( ) : void
Résultat void

routine() public méthode

Registers the idle process.
public routine ( Routine $routine ) : void
$routine XPSPL\Routine
Résultat void

Property Details

$_address protected_oe property

Socket Address
protected string $_address
Résultat string

$_clients protected_oe property

Client sockets currently connected for read/write.
protected array $_clients
Résultat array

$_connection protected_oe property

Socket connection object
protected object $_connection
Résultat object

$_options protected_oe property

Options used for the socket.
protected $_options

$default_wait_time public_oe property

Default socket wait time in seconds.
public int $default_wait_time
Résultat integer