EventBufferEvent::getOutput

(PECL event >= 1.2.6-beta)

EventBufferEvent::getOutputReturns underlying output buffer associated with current buffer event

说明

public EventBufferEvent::getOutput ( void ) : EventBuffer

Returns underlying output buffer associated with current buffer event. An output buffer is a storage for data to be written.

Note, there is also output property of EventBufferEvent class.

参数

此函数没有参数。

返回值

Returns instance of EventBuffer output buffer associated with current buffer event.

范例

Example #1 EventBufferEvent::getOutput() example

<?php
$base 
= new EventBase();

$dns_base = new EventDnsBase($baseTRUE); // Use async DNS resolving
if (!$dns_base) {
    exit(
"Failed to init DNS Base\n");
}

$bev = new EventBufferEvent($base/* use internal socket */ NULL,
    
EventBufferEvent::OPT_CLOSE_ON_FREE EventBufferEvent::OPT_DEFER_CALLBACKS,
    
"readcb"/* writecb */ NULL"eventcb"$base
);
if (!
$bev) {
    exit(
"Failed creating bufferevent socket\n");
}

$bev->enable(Event::READ Event::WRITE);

$output $bev->getOutput();
if (!
$output->add(
    
"GET {$argv[2]} HTTP/1.0\r\n".
    
"Host: {$argv[1]}\r\n".
    
"Connection: Close\r\n\r\n"
)) {
    exit(
"Failed adding request to output buffer\n");
}

/* ... */
?>

参见

相关文章
php eventbufferevent closes file descriptor associated with the current buffer eventphp eventbufferevent free a buffer eventphp eventbufferevent returns bitmask of events currently enabled on the buffer eventphp eventbufferevent returns underlying input buffer associated with current buffer eventphp eventbufferevent returns underlying output buffer associated with current buffer eventphp eventbufferevent returns most recent openssl error reported on the buffer eventphp eventbufferevent returns the name of the protocol used for current ssl connectionphp eventbufferevent creates a new ssl buffer event to send its data over an ssl on a socketphp eventbufferevent adds data to a buffer event s output bufferphp eventbufferevent adds contents of the entire buffer to a buffer event s output bufferphp eventhttprequest returns the output buffer of the requestphp eventlistener returns event base associated with the event listenerphp evloop creates evcheck object associated with the current event loop instancephp evloop creates evchild object associated with the current event loopphp evloop returns the current event loop time php evloop creates evperiodic watcher object associated with the current event loop instancephp evloop creates evprepare watcher object associated with the current event loop instancephp evloop creates evsignal watcher object associated with the current event loop instancephp evloop creates evstat watcher object associated with the current event loop instancephp splobjectstorage returns the data associated with the current iterator entry
关注编程学问公众号