Property | Type | Description | |
---|---|---|---|
$pool | Associated pool |
Property | Type | Description | |
---|---|---|---|
$EOL | EOL | ||
$EOLS | EOLS_* switch | ||
$alive | Alive? | ||
$bev | EventBufferEvent | ||
$bevConnect | Is bevConnect used? | ||
$ctx | Context | ||
$ctxMode | Defines context-related flag | ||
$ctxname | Context name | ||
$fd | File descriptor | ||
$finished | Finished? | ||
$freed | Freed? | ||
$highMark | Default high mark. Maximum number of bytes in buffer | ||
$inited | Initialized? | ||
$lowMark | Default low mark. Minimum number of bytes in buffer | ||
$onWriteOnce | Stack of callbacks called when writing is done | ||
$priority | Priority | ||
$ready | Ready? | ||
$ssl | SSL? | ||
$state | Current state | ||
$timedout | Timeout? | ||
$timeout | Timeout | ||
$timeoutRead | Read timeout | ||
$timeoutWrite | Write timeout | ||
$url | URL | ||
$wRead | Should we can onReadEv() in next onWriteEv()? | ||
$writing | Writing? |
Method | Description | |
---|---|---|
__construct ( resource $fd = null, object $pool = null ) | IOStream constructor | |
__get ( string $name ) : mixed | Getter | |
close ( ) : void | Close the connection | |
drain ( integer $n ) : boolean | Drains buffer | |
drainIfMatch ( string $str ) : boolean | null | Drains buffer it matches the string | |
finish ( ) : void | Finish the session. You should not worry about buffers, they are going to be flushed properly | |
freezeInput ( boolean $at_front = true ) : boolean | Freeze input | |
freezeOutput ( boolean $at_front = true ) : boolean | Freeze output | |
getBev ( ) : EventBufferEvent | Get EventBufferEvent | |
getFd ( ) : resource | Get file descriptor | |
getInputLength ( ) : integer | Returns length of input buffer | |
gracefulShutdown ( ) : boolean | Called when the worker is going to shutdown | |
isFinished ( ) : boolean | Finished? | |
isFreed ( ) : boolean | Freed? | |
look ( integer $n, integer $o ) : string | false | Read from buffer without draining | |
lookExact ( integer $n, integer $o ) : string | false | Reads exact $n bytes of buffer without draining | |
moveToBuffer ( EventBuffer $dest, integer $n ) : integer | false | Moves arbitrary number of bytes from input buffer to given buffer | |
onReadEv ( object $bev ) : void | Called when the connection has got new data | |
onStateEv ( object $bev, integer $events ) : void | Called when the connection state changed | |
onWrite ( ) : void | Called when the connection is ready to accept new data | |
onWriteEv ( object $bev ) : void | Called when the connection is ready to accept new data | |
onWriteOnce ( callable $cb ) : void | Push callback which will be called only once, when writing is available next time | |
prependInput ( string $str ) : boolean | Prepends data to input buffer | |
prependOutput ( string $str ) : boolean | Prepends data to output buffer | |
read ( integer $n ) : string | false | Read data from the connection's buffer | |
readExact ( integer $n ) : string | false | Reads exact $n bytes from buffer | |
readLine ( integer $eol = null ) : string | null | Reads line from buffer | |
readUnlimited ( ) : string | Reads all data from the connection's buffer | |
search ( string $what, integer $start, integer $end ) : integer | Searches first occurence of the string in input buffer | |
setContext ( object $ctx, integer $mode ) : void | Sets context mode | |
setFd ( resource $fd, object $bev = null ) : void | Sets fd | |
setPriority ( integer $p ) : void | Sets priority | |
setTimeout ( integer $rw ) : void | Set timeout | |
setTimeouts ( integer $read, integer $write ) : void | Set timeouts | |
setWatermark ( integer | null $low = null, integer | null $high = null ) : void | Sets watermark | |
substr ( integer $o, integer $n ) : string | false | Read from buffer without draining | |
unfreezeInput ( boolean $at_front = true ) : boolean | Unfreeze input | |
unfreezeOutput ( boolean $at_front = true ) : boolean | Unfreeze output | |
unsetFd ( ) : void | Unsets pointers of associated EventBufferEvent and File descriptr | |
write ( string $data ) : boolean | Send data to the connection. Note that it just writes to buffer that flushes at every baseloop | |
writeFromBuffer ( EventBuffer $src, integer $n ) : integer | false | Moves arbitrary number of bytes from given buffer to output buffer | |
writeln ( string $data ) : boolean | Send data and appending \n to connection. Note that it just writes to buffer flushed at every baseloop |
Method | Description | |
---|---|---|
init ( ) : void | Constructor | |
log ( string $m ) : void | Send message to log | |
onFinish ( ) : void | Called when the session finished | |
onRead ( ) : void | Called when new data received | |
onReady ( ) : void | Called when the stream is handshaked (at low-level), and peer is ready to recv. data |
public __construct ( resource $fd = null, object $pool = null ) | ||
$fd | resource | File descriptor. Optional |
$pool | object | Pool. Optional |
public freezeInput ( boolean $at_front = true ) : boolean | ||
$at_front | boolean | At front. Default is true. If the front of a buffer is frozen, operations that drain data from the front of the buffer, or that prepend data to the buffer, will fail until it is unfrozen. If the back a buffer is frozen, operations that append data from the buffer will fail until it is unfrozen |
return | boolean | Success |
public freezeOutput ( boolean $at_front = true ) : boolean | ||
$at_front | boolean | At front. Default is true. If the front of a buffer is frozen, operations that drain data from the front of the buffer, or that prepend data to the buffer, will fail until it is unfrozen. If the back a buffer is frozen, operations that append data from the buffer will fail until it is unfrozen |
return | boolean | Success |
public getBev ( ) : EventBufferEvent | ||
return | EventBufferEvent |
public getFd ( ) : resource | ||
return | resource | File descriptor |
public getInputLength ( ) : integer | ||
return | integer |
public gracefulShutdown ( ) : boolean | ||
return | boolean | Ready to shutdown? |
public moveToBuffer ( EventBuffer $dest, integer $n ) : integer | false | ||
$dest | EventBuffer | Destination nuffer |
$n | integer | Max. number of bytes to move |
return | integer | false |
public onWriteOnce ( callable $cb ) : void | ||
$cb | callable | Callback |
return | void |
public prependInput ( string $str ) : boolean | ||
$str | string | Data |
return | boolean | Success |
public prependOutput ( string $str ) : boolean | ||
$str | string | Data |
return | boolean | Success |
public readUnlimited ( ) : string | ||
return | string | Readed data |
public setPriority ( integer $p ) : void | ||
$p | integer | Priority |
return | void |
public setTimeout ( integer $rw ) : void | ||
$rw | integer | Timeout |
return | void |
public unfreezeInput ( boolean $at_front = true ) : boolean | ||
$at_front | boolean | At front. Default is true. If the front of a buffer is frozen, operations that drain data from the front of the buffer, or that prepend data to the buffer, will fail until it is unfrozen. If the back a buffer is frozen, operations that append data from the buffer will fail until it is unfrozen |
return | boolean | Success |
public unfreezeOutput ( boolean $at_front = true ) : boolean | ||
$at_front | boolean | At front. Default is true. If the front of a buffer is frozen, operations that drain data from the front of the buffer, or that prepend data to the buffer, will fail until it is unfrozen. If the back a buffer is frozen, operations that append data from the buffer will fail until it is unfrozen |
return | boolean | Success |
public writeFromBuffer ( EventBuffer $src, integer $n ) : integer | false | ||
$src | EventBuffer | Source buffer |
$n | integer | Max. number of bytes to move |
return | integer | false |
protected $highMark |
protected $lowMark |
protected $onWriteOnce |