final class EventUtil (View source)

EventUtil.

EventUtil is a singleton with supplimentary methods and constants.

Constants

AF_INET

AF_INET6

AF_UNIX

AF_UNSPEC

LIBEVENT_VERSION_NUMBER

SO_DEBUG

SO_REUSEADDR

SO_KEEPALIVE

SO_DONTROUTE

SO_LINGER

SO_BROADCAST

SO_OOBINLINE

SO_SNDBUF

SO_RCVBUF

SO_SNDLOWAT

SO_RCVLOWAT

SO_SNDTIMEO

SO_RCVTIMEO

SO_TYPE

SO_ERROR

SOL_SOCKET

SOL_TCP

SOL_UDP

SOCK_RAW

TCP_NODELAY

IPPROTO_IP

IPPROTO_IPV6

Methods

__construct()

__construct.

resource
createSocket(mixed $socket)

No description

static int|false
getLastSocketErrno(mixed $socket = null)

getLastSocketErrno.

static string|false
getLastSocketError(mixed $socket)

getLastSocketError.

static int
getSocketFd(mixed $socket)

getSocketFd.

static bool
getSocketName(mixed $socket, string $address, int $port)

getSocketName.

static bool
setSocketOption(mixed $socket, int $level, int $optname, int|array $optval)

setSocketOption.

static bool
sslRandPoll()

sslRandPoll.

Details

abstract __construct()

__construct.

The abstract constructor.

resource createSocket(mixed $socket)

No description

Parameters

mixed $socket

Return Value

resource

static int|false getLastSocketErrno(mixed $socket = null)

getLastSocketErrno.

Returns the most recent socket error number.

Parameters

mixed $socket

= null

Return Value

int|false

Returns the most recent socket error number( errno ).

See also

https://secure.php.net/manual/en/eventutil.getlastsocketerrno.php

static string|false getLastSocketError(mixed $socket)

getLastSocketError.

Returns the most recent socket error.

Parameters

mixed $socket

Socket resource, stream or a file descriptor of a socket.

Return Value

string|false

Returns the most recent socket error.

See also

https://secure.php.net/manual/en/eventutil.getlastsocketerror.php

static int getSocketFd(mixed $socket)

getSocketFd.

Returns numeric file descriptor of a socket, or stream.

Parameters

mixed $socket

Socket resource or stream.

Return Value

int

Returns numeric file descriptor of a socket, or stream. EventUtil::getSocketFd returns false in case if it is whether failed to recognize the type of the underlying file, or detected that the file descriptor associated with socket is not valid.

See also

https://secure.php.net/manual/en/eventutil.getsocketfd.php

static bool getSocketName(mixed $socket, string $address, int $port)

getSocketName.

Retreives the current address to which the socket is bound.

Parameters

mixed $socket

Socket resource, stream or a file descriptor of a socket.

string $address

Output parameter. IP-address, or the UNIX domain socket path depending on the socket address family.

int $port

Output parameter. The port the socket is bound to. Has no meaning for UNIX domain sockets.

Return Value

bool

Returns true on success or false on failure.

See also

https://secure.php.net/manual/en/eventutil.getsocketname.php

static bool setSocketOption(mixed $socket, int $level, int $optname, int|array $optval)

setSocketOption.

Sets socket options.

Parameters

mixed $socket

Socket resource, stream, or numeric file descriptor associated with the socket.

int $level

One of EventUtil::SOL_* constants. Specifies the protocol level at which the option resides. For example, to retrieve options at the socket level, a level parameter of EventUtil::SOL_SOCKET would be used. Other levels, such as TCP, can be used by specifying the protocol number of that level. Protocol numbers can be found by using the getprotobyname function. See EventUtil constants.

int $optname

Option name(type). Has the same meaning as corresponding parameter of socket_get_option function. See EventUtil constants.

int|array $optval

Accepts the same values as optval parameter of the socket_get_option function.

Return Value

bool

Returns true on success or false on failure.

See also

https://secure.php.net/manual/en/eventutil.setsocketoption.php

static bool sslRandPoll()

sslRandPoll.

Generates entropy by means of OpenSSL's RAND_poll().