Properties

$statistics

$statistics : array

Statistics for status command.

Type

array

$onMessage

$onMessage : callback

Emitted when data is received.

Type

callback

$onClose

$onClose : callback

Emitted when socket connection closed.

Type

callback

$onError

$onError : callback

Emitted when an error occurs with connection.

Type

callback

$onConnect

$onConnect : callback

Emitted when socket connection is successfully established.

Type

callback

$_socket

$_socket : resource

Udp socket.

Type

resource

$_remoteAddress

$_remoteAddress : string

Remote address.

Type

string

$connected

$connected : boolean

Connected or not.

Type

boolean

$_contextOption

$_contextOption : array

Context option.

Type

array

Methods

__construct()

__construct(string  $remote_address,   $context_option = null) 

Construct.

Parameters

string $remote_address
$context_option

Throws

\Exception

send()

send(string  $send_buffer, boolean  $raw = false) : void|boolean

Sends data on the connection.

Parameters

string $send_buffer
boolean $raw

Returns

void|boolean

getRemoteIp()

getRemoteIp() : string

Get remote IP.

Returns

string

getRemotePort()

getRemotePort() : integer

Get remote port.

Returns

integer

getRemoteAddress()

getRemoteAddress() : string

Get remote address.

Returns

string

getLocalIp()

getLocalIp() : string

Get local IP.

Returns

string

getLocalPort()

getLocalPort() : integer

Get local port.

Returns

integer

getLocalAddress()

getLocalAddress() : string

Get local address.

Returns

string

isIpV4()

isIpV4() 

Is ipv4.

return bool.

isIpV6()

isIpV6() 

Is ipv6.

return bool.

close()

close(mixed  $data = null, boolean  $raw = false) : boolean

Close connection.

Parameters

mixed $data
boolean $raw

Returns

boolean

isIPv4()

isIPv4() : boolean

Is ipv4.

Returns

boolean

isIPv6()

isIPv6() : boolean

Is ipv6.

Returns

boolean

baseRead()

baseRead(resource  $socket) : boolean

For udp package.

Parameters

resource $socket

Returns

boolean

connect()

connect() : void

Connect.