|
The EventBufferEvent classIntroductionRepresents Libevent's buffer event. Usually an application wants to perform some amount of data buffering in addition to just responding to events. When we want to write data, for example, the usual pattern looks like:
This buffered I/O pattern is common enough that Libevent provides a generic mechanism for it. A "buffer event" consists of an underlying transport (like a socket), a read buffer, and a write buffer. Instead of regular events, which give callbacks when the underlying transport is ready to be read or written, a buffer event invokes its user-supplied callbacks when it has read or written enough data. Class synopsis
EventBufferEvent
final
class EventBufferEvent
{
/* Constants */
const
int
EventBufferEvent::READING = 1;
const
int
EventBufferEvent::WRITING = 2;
const
int
EventBufferEvent::EOF = 16;
const
int
EventBufferEvent::ERROR = 32;
const
int
EventBufferEvent::TIMEOUT = 64;
const
int
EventBufferEvent::CONNECTED = 128;
const
int
EventBufferEvent::OPT_CLOSE_ON_FREE = 1;
const
int
EventBufferEvent::OPT_THREADSAFE = 2;
const
int
EventBufferEvent::OPT_DEFER_CALLBACKS = 4;
const
int
EventBufferEvent::OPT_UNLOCK_CALLBACKS = 8;
const
int
EventBufferEvent::SSL_OPEN = 0;
const
int
EventBufferEvent::SSL_CONNECTING = 1;
const
int
EventBufferEvent::SSL_ACCEPTING = 2;
/* Properties */
public
int
$fd;
public
int
$priority;
public
readonly
EventBuffer
$input;
public
readonly
EventBuffer
$output;
/* Methods */
public
void close()
public
bool connect(
string
$addr
)public
bool connectHost(
EventDnsBase $dns_base
,string $hostname
,int $port
,int $family
= EventUtil::AF_UNSPEC
) public
__construct(
EventBase $base
,mixed $socket
= null
,int $options
= 0
,callable $readcb
= null
,callable $writecb
= null
,callable $eventcb
= null
,mixed $arg
= null
) public
static
array createPair(
EventBase
$base
,
int
$options
= 0
)public
bool disable(
int
$events
)public
bool enable(
int
$events
)public
void free()
public
string getDnsErrorString()
public
int getEnabled()
public
EventBuffer getInput()
public
EventBuffer getOutput()
public
string read(
int
$size
)public
bool readBuffer(
EventBuffer
$buf
)public
void setCallbacks(
callable $readcb
,callable $writecb
,callable $eventcb
,mixed $arg
= ?) public
bool setPriority(
int
$priority
)public
bool setTimeouts(
float
$timeout_read
,
float
$timeout_write
)public
void setWatermark(
int
$events
,
int
$lowmark
,
int
$highmark
)public
string sslError()
public
static
EventBufferEvent sslFilter(
EventBase $base
,EventBufferEvent $underlying
,EventSslContext $ctx
,int $state
,int $options
= 0
) public
string sslGetCipherInfo()
public
string sslGetCipherName()
public
string sslGetCipherVersion()
public
string sslGetProtocol()
public
void sslRenegotiate()
public
static
EventBufferEvent sslSocket(
EventBase $base
,mixed $socket
,EventSslContext $ctx
,int $state
,int $options
= ?) public
bool write(
string
$data
)public
bool writeBuffer(
EventBuffer
}$buf
)Properties
Predefined Constants
|