Geen cache-versie.


Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code LNG204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.

Rechercher une fonction PHP

The EventBufferEvent class

(PECL event >= 1.2.6-beta)

Introduction

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:

  1. Decide that we want to write some data to a connection; put that data in a buffer.

  2. Wait for the connection to become writable

  3. Write as much of the data as we can

  4. 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.

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

Class synopsis

final EventBufferEvent {
/* Constants */
const integer READING = 1 ;
const integer WRITING = 2 ;
const integer EOF = 16 ;
const integer ERROR = 32 ;
const integer TIMEOUT = 64 ;
const integer CONNECTED = 128 ;
const integer OPT_CLOSE_ON_FREE = 1 ;
const integer OPT_THREADSAFE = 2 ;
const integer OPT_DEFER_CALLBACKS = 4 ;
const integer OPT_UNLOCK_CALLBACKS = 8 ;
const integer SSL_OPEN = 0 ;
const integer SSL_CONNECTING = 1 ;
const integer SSL_ACCEPTING = 2 ;
/* Properties */
public integer $fd ;
public integer $priority ;
public readonly EventBuffer $input ;
public readonly EventBuffer $output ;
/* Methods */
public close ( void ) : void
public connect ( string $addr ) : bool
public connectHost ( EventDnsBase $dns_base , string $hostname , int $port [, int $family = EventUtil::AF_UNSPEC ] ) : bool
public __construct ( EventBase $base [, mixed $socket = NULL [, int $options = 0 [, callable $readcb = NULL [, callable $writecb = NULL [, callable $eventcb = NULL ]]]]] )
public static createPair ( EventBase $base [, int $options = 0 ] ) : array
public disable ( int $events ) : bool
public enable ( int $events ) : bool
public free ( void ) : void
public getDnsErrorString ( void ) : string
public getEnabled ( void ) : int
public getInput ( void ) : EventBuffer
public getOutput ( void ) : EventBuffer
public read ( int $size ) : string
public readBuffer ( EventBuffer $buf ) : bool
public setCallbacks ( callable $readcb , callable $writecb , callable $eventcb [, string $arg ] ) : void
public setPriority ( int $priority ) : bool
public setTimeouts ( float $timeout_read , float $timeout_write ) : bool
public setWatermark ( int $events , int $lowmark , int $highmark ) : void
public sslError ( void ) : string
public static sslFilter ( EventBase $base , EventBufferEvent $underlying , EventSslContext $ctx , int $state [, int $options = 0 ] ) : EventBufferEvent
public sslGetCipherInfo ( void ) : string
public sslGetCipherName ( void ) : string
public sslGetCipherVersion ( void ) : string
public sslGetProtocol ( void ) : string
public sslRenegotiate ( void ) : void
public static sslSocket ( EventBase $base , mixed $socket , EventSslContext $ctx , int $state [, int $options ] ) : EventBufferEvent
public write ( string $data ) : bool
public writeBuffer ( EventBuffer $buf ) : bool
}

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

Properties

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 )

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

Predefined Constants

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

EventBufferEvent::CONNECTED

Finished a requested connection on the bufferevent.

EventBufferEvent::OPT_CLOSE_ON_FREE

When the buffer event is freed, close the underlying transport. This will close an underlying socket, free an underlying buffer event, etc.

EventBufferEvent::OPT_THREADSAFE

Automatically allocate locks for the bufferevent, so that it’s safe to use from multiple threads.

EventBufferEvent::OPT_DEFER_CALLBACKS

When this flag is set, the bufferevent defers all of its callbacks. See » Fast portable non-blocking network programming with Libevent, Deferred callbacks .

EventBufferEvent::OPT_UNLOCK_CALLBACKS

By default, when the bufferevent is set up to be threadsafe, the buffer event’s locks are held whenever the any user-provided callback is invoked. Setting this option makes Libevent release the buffer event’s lock when it’s invoking the callbacks.

EventBufferEvent::SSL_OPEN

The SSL handshake is done

EventBufferEvent::SSL_CONNECTING

SSL is currently performing negotiation as a client

EventBufferEvent::SSL_ACCEPTING

SSL is currently performing negotiation as a server

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

Table of Contents

Zoek een PHP-functie

Vertaling niet beschikbaar

De PHP-handleiding is nog niet in het Nederlands vertaald, dus het scherm is in het Engels. Als u wilt, kunt u het ook in het Frans of in het Duits raadplegen.

Als je de moed voelt, kun je je vertaling aanbieden ;-)

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 30/01/2003 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/php-rf-class.eventbufferevent.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : http://php.net

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut