PHP Class Kafka\Socket

Exibir arquivo Open project: nmred/kafka-php Class Usage Examples

Public Methods

Method Description
__construct ( $host, $port, integer $recvTimeoutSec, integer $recvTimeoutUsec = 750000, integer $sendTimeoutSec, integer $sendTimeoutUsec = 100000 ) __construct
close ( ) : void close the socket
connect ( ) : void Connects the socket
createFromStream ( $stream ) : Socket Optional method to set the internal stream handle
isResource ( ) : boolean checks if the socket is a valid resource
read ( integer $len, boolean $verifyExactLength = false ) : string Read from the socket at most $len bytes.
rewind ( ) : void Rewind the stream
setMaxWriteAttempts ( integer $number )
setRecvTimeoutSec ( float $recvTimeoutSec )
setRecvTimeoutUsec ( float $recvTimeoutUsec )
setSendTimeoutSec ( float $sendTimeoutSec )
setSendTimeoutUsec ( float $sendTimeoutUsec )
setStream ( mixed $stream ) : void Optional method to set the internal stream handle
write ( string $buf ) : integer Write to the socket.

Method Details

__construct() public method

__construct
public __construct ( $host, $port, integer $recvTimeoutSec, integer $recvTimeoutUsec = 750000, integer $sendTimeoutSec, integer $sendTimeoutUsec = 100000 )
$host
$port
$recvTimeoutSec integer
$recvTimeoutUsec integer
$sendTimeoutSec integer
$sendTimeoutUsec integer

close() public method

close the socket
public close ( ) : void
return void

connect() public method

Connects the socket
public connect ( ) : void
return void

createFromStream() public static method

Optional method to set the internal stream handle
public static createFromStream ( $stream ) : Socket
$stream
return Socket

isResource() public method

checks if the socket is a valid resource
public isResource ( ) : boolean
return boolean

read() public method

This method will not wait for all the requested data, it will return as soon as any data is received.
public read ( integer $len, boolean $verifyExactLength = false ) : string
$len integer Maximum number of bytes to read.
$verifyExactLength boolean Throw an exception if the number of read bytes is less than $len
return string Binary data

rewind() public method

Rewind the stream
public rewind ( ) : void
return void

setMaxWriteAttempts() public method

public setMaxWriteAttempts ( integer $number )
$number integer

setRecvTimeoutSec() public method

public setRecvTimeoutSec ( float $recvTimeoutSec )
$recvTimeoutSec float

setRecvTimeoutUsec() public method

public setRecvTimeoutUsec ( float $recvTimeoutUsec )
$recvTimeoutUsec float

setSendTimeoutSec() public method

public setSendTimeoutSec ( float $sendTimeoutSec )
$sendTimeoutSec float

setSendTimeoutUsec() public method

public setSendTimeoutUsec ( float $sendTimeoutUsec )
$sendTimeoutUsec float

setStream() public method

Optional method to set the internal stream handle
public setStream ( mixed $stream ) : void
$stream mixed
return void

write() public method

Write to the socket.
public write ( string $buf ) : integer
$buf string The data to write
return integer