PHP Class TSocket, phpcassa

Inheritance: extends TTransport, implements TTransportStatus, implements InstrumentedTTransport, use trait InstrumentedTTransportTrait
ファイルを表示 Open project: hoan/phpcassa Class Usage Examples

Protected Properties

Property Type Description
$debugHandler_ mixed Debug handler
$debug_ boolean Debugging on?
$host_ string Remote hostname
$port_ integer Remote port

Public Methods

Method Description
__construct ( string $host = 'localhost', integer $port = 9090, boolean $persist = FALSE, string $debugHandler = null ) Socket constructor
close ( ) Closes the socket.
flush ( ) Flush output to the socket.
getHost ( ) : string Get the host that this socket is connected to
getPort ( ) : integer Get the remote port that this socket is connected to
isOpen ( ) : boolean Tests whether this is open
open ( ) Connects the socket.
read ( integer $len ) : string Read from the socket
readAll ( integer $len ) : string Uses stream get contents to do the reading
setDebug ( boolean $debug ) Sets debugging output on or off
setRecvTimeout ( integer $timeout ) Sets the receive timeout.
setSendTimeout ( integer $timeout ) Sets the send timeout.
write ( string $buf ) Write to the socket.

Method Details

__construct() public method

Socket constructor
public __construct ( string $host = 'localhost', integer $port = 9090, boolean $persist = FALSE, string $debugHandler = null )
$host string Remote hostname
$port integer Remote port
$persist boolean Whether to use a persistent socket
$debugHandler string Function to call for error logging

close() public method

Closes the socket.
public close ( )

flush() public method

Flush output to the socket.
public flush ( )

getHost() public method

Get the host that this socket is connected to
public getHost ( ) : string
return string host

getPort() public method

Get the remote port that this socket is connected to
public getPort ( ) : integer
return integer port

isOpen() public method

Tests whether this is open
public isOpen ( ) : boolean
return boolean true if the socket is open

open() public method

Connects the socket.
public open ( )

read() public method

Read from the socket
public read ( integer $len ) : string
$len integer How many bytes
return string Binary data

readAll() public method

Uses stream get contents to do the reading
public readAll ( integer $len ) : string
$len integer How many bytes
return string Binary data

setDebug() public method

Sets debugging output on or off
public setDebug ( boolean $debug )
$debug boolean

setRecvTimeout() public method

Sets the receive timeout.
public setRecvTimeout ( integer $timeout )
$timeout integer Timeout in milliseconds.

setSendTimeout() public method

Sets the send timeout.
public setSendTimeout ( integer $timeout )
$timeout integer Timeout in milliseconds.

write() public method

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

Property Details

$debugHandler_ protected_oe property

Debug handler
protected mixed $debugHandler_
return mixed

$debug_ protected_oe property

Debugging on?
protected bool $debug_
return boolean

$host_ protected_oe property

Remote hostname
protected string $host_
return string

$port_ protected_oe property

Remote port
protected int $port_
return integer