The EventBufferEvent class
(PECL event >= 1.2.6-beta)
はじめに
Represents 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:
-
Decide that we want to write some data to a connection; put that data in a buffer.
-
Wait for the connection to become writable
-
Write as much of the data as we can
-
Remember how much we wrote, and if we still have more data to write, wait for the connection to become writable again.
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.
クラス概要
EventDnsBase
$dns_base
,string
$hostname
,int
$port
,int
$family
= EventUtil::AF_UNSPEC
): bool
EventBase
$base
,mixed
$socket
= null
,int
$options
= 0
,callable
$readcb
= null
,callable
$writecb
= null
,callable
$eventcb
= null
,mixed
$arg
= null
)
callable
$readcb
,callable
$writecb
,callable
$eventcb
,mixed
$arg
= ?): void
EventBase
$base
,EventBufferEvent
$underlying
,EventSslContext
$ctx
,int
$state
,int
$options
= 0
): EventBufferEvent
EventBase
$base
,mixed
$socket
,EventSslContext
$ctx
,int
$state
,int
$options
= ?): EventBufferEvent
プロパティ
- fd
-
Numeric file descriptor associated with the buffer event. Normally represents a bound socket. Equals to
null
, if there is no file descriptor(socket) associated with the buffer event. - priority
-
The priority of the events used to implement the buffer event.
- input
-
Underlying input buffer object( EventBuffer )
- output
-
Underlying output buffer object( EventBuffer )
定義済み定数
-
EventBufferEvent::READING
-
An event occurred during a read operation on the bufferevent. See the other flags for which event it was.
-
EventBufferEvent::WRITING
-
An event occurred during a write operation on the bufferevent. See the other flags for which event it was.
-
EventBufferEvent::EOF
-
Got an end-of-file indication on the buffer event.
-
EventBufferEvent::ERROR
-
An error occurred during a bufferevent operation. For more information on what the error was, call EventUtil::getLastSocketErrno() and/or EventUtil::getLastSocketError() .
-
EventBufferEvent::TIMEOUT