PHP Class LdapTools\Utilities\TcpSocket

Author: Chad Sikorra ([email protected])
Show file Open project: ldaptools/ldaptools Class Usage Examples

Protected Properties

Property Type Description
$options array
$socket boolean | resource

Public Methods

Method Description
__construct ( array $options = [] )
close ( ) Close the connection to the host.
connect ( string $host, integer $port, integer $timeout = 1 ) : boolean Connect to the host on the port defined for this TCP socket.
enableEncryption ( integer $cryptoMethod = null ) : boolean Enable encryption for the socket connection.
getParams ( ) : array Get parameter/option information from the TCP socket stream/context.
read ( integer $length ) Read data from the TCP socket.
setOperationTimeout ( integer $timeout ) : boolean Sets the timeout (in seconds) for TCP operations (not the initial connection attempt).
write ( mixed $data ) : integer Write data to the TCP socket.

Method Details

__construct() public method

public __construct ( array $options = [] )
$options array The TCP stream context options.

close() public method

Close the connection to the host.
public close ( )

connect() public method

Connect to the host on the port defined for this TCP socket.
public connect ( string $host, integer $port, integer $timeout = 1 ) : boolean
$host string
$port integer
$timeout integer
return boolean

enableEncryption() public method

Enable encryption for the socket connection.
public enableEncryption ( integer $cryptoMethod = null ) : boolean
$cryptoMethod integer
return boolean

getParams() public method

Get parameter/option information from the TCP socket stream/context.
public getParams ( ) : array
return array

read() public method

Read data from the TCP socket.
public read ( integer $length )
$length integer

setOperationTimeout() public method

Sets the timeout (in seconds) for TCP operations (not the initial connection attempt).
public setOperationTimeout ( integer $timeout ) : boolean
$timeout integer
return boolean

write() public method

Write data to the TCP socket.
public write ( mixed $data ) : integer
$data mixed
return integer

Property Details

$options protected property

protected array $options
return array

$socket protected property

protected bool|resource $socket
return boolean | resource