PHP Класс lithium\net\Socket

Наследование: extends lithium\core\Object
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$_autoConfig array Auto config.
$_classes array The classes for the socket.
$_resource resource The resource for the current connection.

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

Метод Описание
__construct ( array $config = [] ) : void Constructor.
__destruct ( ) : void Destructor.
close ( ) : boolean Closes the socket and unsets Socket::$_resource.
encoding ( string $charset ) : boolean Sets the encoding of the socket connection.
eof ( ) : boolean Test for the end-of-file on the socket.
open ( array $options = [] ) : mixed Opens the socket and sets Socket::$_resource.
read ( ) : object Reads from the socket.
resource ( ) : resource Returns the resource.
send ( Message $message = null, array $options = [] ) : object Aggregates read and write methods into a coherent request response
set ( array $flags, array $value = null ) : void Sets the options to be used in subsequent requests.
timeout ( integer $time ) : boolean Sets the timeout on the socket *connection*.
write ( mixed $data ) : boolean Writes data to the socket.

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

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

Constructor.
public __construct ( array $config = [] ) : void
$config array Available configuration options are: - `'persistent'`: Use a persistent connection (defaults to `false`). - `'protocol'`: Transfer protocol to use (defaults to `'tcp'`). - `'host'`: Host name or address (defaults to `'localhost'`). - `'login'`: Username for a login (defaults to `'root'`). - `'password'`: Password for a login (defaults to `''`). - `'port'`: Host port (defaults to `80`). - `'timeout'`: Seconds after opening the socket times out (defaults to `30`).
Результат void

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

Destructor.
public __destruct ( ) : void
Результат void

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

Closes the socket and unsets Socket::$_resource.
abstract public close ( ) : boolean
Результат boolean `true` on success, `false` otherwise.

encoding() абстрактный публичный Метод

Sets the encoding of the socket connection.
abstract public encoding ( string $charset ) : boolean
$charset string The character set to use.
Результат boolean `true` if encoding has been set, `false` otherwise.

eof() абстрактный публичный Метод

Test for the end-of-file on the socket.
abstract public eof ( ) : boolean
Результат boolean `true` if end has been reached, `false` otherwise.

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

Opens the socket and sets Socket::$_resource.
public open ( array $options = [] ) : mixed
$options array Update the config settings.
Результат mixed The open resource on success, `false` otherwise.

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

Reads from the socket.
abstract public read ( ) : object
Результат object `lithium\net\Message`

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

Returns the resource.
public resource ( ) : resource
Результат resource

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

Aggregates read and write methods into a coherent request response
public send ( Message $message = null, array $options = [] ) : object
$message Message
$options array - '`response`': a fully-namespaced string for the response object
Результат object a response object based on `\lithium\net\Message`

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

Sets the options to be used in subsequent requests.
public set ( array $flags, array $value = null ) : void
$flags array If $values is an array, $flags will be used as the keys to an associative array of curl options. If $values is not set, then $flags will be used as the associative array.
$value array If set, this array becomes the values for the associative array of curl options.
Результат void

timeout() абстрактный публичный Метод

Sets the timeout on the socket *connection*.
abstract public timeout ( integer $time ) : boolean
$time integer Seconds after the connection times out.
Результат boolean `true` if timeout has been set, `false` otherwise.

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

Writes data to the socket.
abstract public write ( mixed $data ) : boolean
$data mixed
Результат boolean `true` if data has been successfully written, `false` otherwise.

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

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

Auto config.
protected array $_autoConfig
Результат array

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

The classes for the socket.
protected array $_classes
Результат array

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

The resource for the current connection.
protected resource $_resource
Результат resource