\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
$transport
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 : callable

Emitted when data is received.

Type

callable

$onClose

$onClose : callable

Emitted when the other end of the socket sends a FIN packet.

Type

callable

$onError

$onError : callable

Emitted when an error occurs with connection.

Type

callable

$protocol

$protocol : \Workerman\Protocols\ProtocolInterface

Application layer protocol.

The format is like this Workerman\Protocols\Http.

Type

ProtocolInterface

$transport

$transport : string

Transport layer protocol.

Type

string

$_socket

$_socket : resource

Udp socket.

Type

resource

$_remoteAddress

$_remoteAddress : string

Remote address.

Type

string

Methods

send()

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

Sends data on the connection.

Parameters

string $send_buffer
bool $raw

Returns

void|bool —

getRemoteIp()

getRemoteIp() : string

Get remote IP.

Returns

string —

getRemotePort()

getRemotePort() : int

Get remote port.

Returns

int —

getRemoteAddress()

getRemoteAddress() : string

Get remote address.

Returns

string —

getLocalIp()

getLocalIp() : string

Get local IP.

Returns

string —

getLocalPort()

getLocalPort() : int

Get local port.

Returns

int —

getLocalAddress()

getLocalAddress() : string

Get local address.

Returns

string —

isIPv4()

isIPv4() : bool

Is ipv4.

Returns

bool —

isIPv6()

isIPv6() : bool

Is ipv6.

Returns

bool —

close()

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

Close connection.

Parameters

mixed $data
bool $raw

Returns

bool —

__construct()

__construct(resource  $socket, string  $remote_address) : mixed

Construct.

Parameters

resource $socket
string $remote_address

Returns

mixed —

isIpV4()

isIpV4() : mixed

Is ipv4.

Returns

mixed —

isIpV6()

isIpV6() : mixed

Is ipv6.

Returns

mixed —