PHPKonf: Istanbul PHP Conference 2017

The EventListener class

(PECL event >= 1.5.0)


Represents a connection listener.

Sinopse da classe

final EventListener {
/* Constants */
const integer OPT_LEAVE_SOCKETS_BLOCKING = 1 ;
const integer OPT_CLOSE_ON_FREE = 2 ;
const integer OPT_CLOSE_ON_EXEC = 4 ;
const integer OPT_REUSEABLE = 8 ;
const integer OPT_THREADSAFE = 16 ;
/* Propriedades */
public readonly int $fd ;
/* Métodos */
public __construct ( EventBase $base , callable $cb , mixed $data , int $flags , int $backlog , mixed $target )
public bool disable ( void )
public bool enable ( void )
public void getBase ( void )
public static bool getSocketName ( string &$address [, mixed &$port ] )
public void setCallback ( callable $cb [, mixed $arg = NULL ] )
public void setErrorCallback ( string $cb )



Numeric file descriptor of the underlying socket. (Added in event-1.6.0 .)

Constantes pré-definidas


By default Libevent turns underlying file descriptors, or sockets, to non-blocking mode. This flag tells to leave them non-blocking.


If this option is set, the connection listener closes its underlying socket when the EventListener object is freed.


If this option is set, the connection listener sets the close-on-exec flag on the underlying listener socket. See platform documentation for fcntl and FD_CLOEXEC for more information.


By default on some platforms, once a listener socket is closed, no other socket can bind to the same port until a while has passed. Setting this option makes Libevent mark the socket as reusable, so that once it is closed, another socket can be opened to listen on the same port.


Allocate locks for the listener, so that it’s safe to use it from multiple threads.


add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top