PHP Класс Horde\Socket\Client

Автор: Michael Slusarz ([email protected])
Автор: Jan Schneider ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_connected boolean Is there an active connection?
$_params array Configuration parameters.
$_secure boolean Is the connection secure?
$_stream resource The actual socket.

Открытые методы

Метод Описание
__clone ( ) This object can not be cloned.
__construct ( string $host, integer $port = null, integer $timeout = 30, mixed $secure = false, array $context = [], array $params = [] ) Constructor.
__get ( $name )
__sleep ( ) This object can not be serialized.
close ( ) Close the connection.
getStatus ( ) : array Returns information about the connection.
gets ( integer $size ) : string Returns a line of data.
read ( integer $size ) : string Returns a specified amount of data.
startTls ( ) : boolean Start a TLS connection.
write ( string $data ) Writes data to the stream.

Защищенные методы

Метод Описание
_checkStream ( ) Throws an exception is the stream is not a resource.
_connect ( $host, $port, $timeout, $secure, $context, $retries ) Connect to the remote server.

Описание методов

__clone() публичный Метод

This object can not be cloned.
public __clone ( )

__construct() публичный Метод

Constructor.
public __construct ( string $host, integer $port = null, integer $timeout = 30, mixed $secure = false, array $context = [], array $params = [] )
$host string Hostname of remote server (can contain protocol prefx).
$port integer Port number of remote server.
$timeout integer Connection timeout (in seconds).
$secure mixed Security layer requested. One of: - false: (No encryption) [DEFAULT] - 'ssl': (Auto-detect SSL version) - 'sslv2': (Force SSL version 3) - 'sslv3': (Force SSL version 2) - 'tls': (TLS; started via protocol-level negotation over unencrypted channel) - 'tlsv1': (TLS version 1.x connection) - true: (TLS if available/necessary)
$context array Any context parameters passed to stream_create_context().
$params array Additional options.

__get() публичный Метод

public __get ( $name )

__sleep() публичный Метод

This object can not be serialized.
public __sleep ( )

_checkStream() защищенный Метод

Throws an exception is the stream is not a resource.
protected _checkStream ( )

_connect() защищенный Метод

Connect to the remote server.
См. также: __construct()
protected _connect ( $host, $port, $timeout, $secure, $context, $retries )

close() публичный Метод

Close the connection.
public close ( )

getStatus() публичный Метод

Currently returns four entries in the result array: - timed_out (bool): The socket timed out waiting for data - blocked (bool): The socket was blocked - eof (bool): Indicates EOF event - unread_bytes (int): Number of bytes left in the socket buffer
public getStatus ( ) : array
Результат array Information about existing socket resource.

gets() публичный Метод

Returns a line of data.
public gets ( integer $size ) : string
$size integer Reading ends when $size - 1 bytes have been read, or a newline or an EOF (whichever comes first).
Результат string $size bytes of data from the socket

read() публичный Метод

Returns a specified amount of data.
public read ( integer $size ) : string
$size integer The number of bytes to read from the socket.
Результат string $size bytes of data from the socket.

startTls() публичный Метод

Start a TLS connection.
public startTls ( ) : boolean
Результат boolean Whether TLS was successfully started.

write() публичный Метод

Writes data to the stream.
public write ( string $data )
$data string Data to write.

Описание свойств

$_connected защищенное свойство

Is there an active connection?
protected bool $_connected
Результат boolean

$_params защищенное свойство

Configuration parameters.
protected array $_params
Результат array

$_secure защищенное свойство

Is the connection secure?
protected bool $_secure
Результат boolean

$_stream защищенное свойство

The actual socket.
protected resource $_stream
Результат resource