|
| __construct ( $host, $port=null, $timeout=30, $secure=false, $context=array(), array $params=array()) |
| Constructor.
|
|
| __clone () |
| This object can not be cloned.
|
|
| __get ($name) |
|
| __sleep () |
| This object can not be serialized.
|
|
| close () |
| Close the connection.
|
|
| gets ($size) |
| Returns a line of data.
|
|
| getStatus () |
| Returns information about the connection.
|
|
| read ($size) |
| Returns a specified amount of data.
|
|
| startTls () |
| Start a TLS connection.
|
|
| write ($data) |
| Writes data to the stream.
|
|
|
| _checkStream () |
| Throws an exception is the stream is not a resource.
|
|
| _connect ( $host, $port, $timeout, $secure, $context, $retries=0) |
| Connect to the remote server.
|
|
|
boolean | $_connected = false |
| Is there an active connection?
|
|
array | $_params |
| Configuration parameters.
|
|
boolean | $_secure = false |
| Is the connection secure?
|
|
resource | $_stream |
| The actual socket.
|
|
◆ __construct()
Client::__construct |
( |
| $host, |
|
|
| $port = null, |
|
|
| $timeout = 30, |
|
|
| $secure = false, |
|
|
| $context = array(), |
|
|
array | $params = array() ) |
Constructor.
- Parameters
-
string | $host | Hostname of remote server (can contain protocol prefx). |
integer | $port | Port number of remote server. |
integer | $timeout | Connection timeout (in seconds). |
mixed | $secure | 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)
|
array | $context | Any context parameters passed to stream_create_context(). |
array | $params | Additional options. |
- Exceptions
-
Horde\Socket\Client\Exception | |
◆ _checkStream()
Throws an exception is the stream is not a resource.
- Exceptions
-
Horde\Socket\Client\Exception | |
◆ _connect()
Client::_connect |
( |
| $host, |
|
|
| $port, |
|
|
| $timeout, |
|
|
| $secure, |
|
|
| $context, |
|
|
| $retries = 0 ) |
|
protected |
Connect to the remote server.
- See also
- __construct()
- Exceptions
-
Horde\Socket\Client\Exception | |
◆ gets()
Returns a line of data.
- Parameters
-
int | $size | Reading ends when $size - 1 bytes have been read, or a newline or an EOF (whichever comes first). |
- Exceptions
-
Horde\Socket\Client\Exception | |
- Return values
-
string\$size | bytes of data from the socket |
◆ getStatus()
Returns information about the connection.
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
- Exceptions
-
Horde\Socket\Client\Exception | |
- Return values
-
array | Information about existing socket resource. |
◆ read()
Returns a specified amount of data.
- Parameters
-
integer | $size | The number of bytes to read from the socket. |
- Exceptions
-
Horde\Socket\Client\Exception | |
- Return values
-
string\$size | bytes of data from the socket. |
◆ startTls()
Start a TLS connection.
- Return values
-
boolean | Whether TLS was successfully started. |
◆ write()
Writes data to the stream.
- Parameters
-
string | $data | Data to write. |
- Exceptions
-
Horde\Socket\Client\Exception | |
The documentation for this class was generated from the following file:
- lib/horde/framework/Horde/Socket/Client.php