\Workerman\ConnectionUdpConnection

UdpConnection.

Summary

Methods
Properties
Constants
send()
getRemoteIp()
getRemotePort()
getRemoteAddress()
getLocalIp()
getLocalPort()
getLocalAddress()
isIPv4()
isIPv6()
close()
__construct()
isIpV4()
isIpV6()
$statistics
$onMessage
$onClose
$onError
$protocol
No constants found
No protected methods found
$_socket
$_remoteAddress
N/A
No private methods found
No private properties found
N/A

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 the other end of the socket sends a FIN packet.

Type

callback

$onError

$onError : callback

Emitted when an error occurs with connection.

Type

callback

$_socket

$_socket : resource

Udp socket.

Type

resource

$_remoteAddress

$_remoteAddress : string

Remote address.

Type

string

Methods

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() : boolean

Is ipv4.

Returns

boolean

isIPv6()

isIPv6() : boolean

Is ipv6.

Returns

boolean

close()

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

Close connection.

Parameters

mixed $data
boolean $raw

Returns

boolean

__construct()

__construct(resource  $socket, string  $remote_address) 

Construct.

Parameters

resource $socket
string $remote_address

isIpV4()

isIpV4() 

Is ipv4.

return bool.

isIpV6()

isIpV6() 

Is ipv6.

return bool.