\swooleSocket

Framed transport. Writes and reads data in chunks that are stamped with their length.

Summary

Methods
Properties
Constants
__construct()
isOpen()
open()
close()
read()
putBack()
readFrame()
write()
flush()
readAll()
setHandle()
_read()
$buffer
$offset
$server
No constants found
No protected methods found
$rBuf_
$wBuf_
$read_
$fd
N/A
No private methods found
$transport_
$write_
N/A

Properties

$buffer

$buffer : 

Type

$offset

$offset : 

Type

$server

$server : 

Type

$rBuf_

$rBuf_ : string

Buffer for read data.

Type

string

$wBuf_

$wBuf_ : string

Buffer for queued output data

Type

string

$read_

$read_ : boolean

Whether to frame reads

Type

boolean

$fd

$fd : 

Type

$write_

$write_ : boolean

Whether to frame writes

Type

boolean

Methods

__construct()

__construct(\Thrift\Transport\TTransport  $transport = null,   $read = true,   $write = true) 

Constructor.

Parameters

\Thrift\Transport\TTransport $transport

Underlying transport

$read
$write

isOpen()

isOpen() : boolean

Whether this transport is open.

Returns

boolean —

true if open

open()

open() 

Open the transport for reading/writing

Throws

\Thrift\Transport\TTransportException

if cannot open

close()

close() 

Close the transport.

read()

read(integer  $len) : string

Reads from the buffer. When more data is required reads another entire chunk and serves future reads out of that.

Parameters

integer $len

How much data

Returns

string —

The data that has been read

putBack()

putBack(string  $data) 

Put previously read data back into the buffer

Parameters

string $data

data to return

readFrame()

readFrame() 

Reads a chunk of data into the internal read buffer.

write()

write(string  $buf) 

Writes some data to the pending output buffer.

Parameters

string $buf

The data

flush()

flush() 

Writes the output buffer to the stream in the format of a 4-byte length followed by the actual data.

readAll()

readAll(  $len) : string

Guarantees that the full amount of data is read.

Parameters

$len

Throws

\Thrift\Transport\TTransportException

if cannot read data

Returns

string —

The data, of exact length

setHandle()

setHandle(  $fd) 

Parameters

$fd

_read()

_read(  $len) 

Parameters

$len