Public Member Functions | |
__construct () | |
__destruct () | |
setHost ($host) | |
| |
getHost () | |
setPort ($port) | |
| |
getPort () | |
isConnected () | |
getInputStream () | |
| |
getOutputStream () | |
| |
connect ($connectTimeout=self::DEFAULT_TIMEOUT) | |
| |
setReadTimeout ($timeout) | |
| |
setWriteTimeout ($timeout) | |
| |
setTimeout ($timeout) | |
| |
getReadTimeout () | |
getWriteTimeout () | |
read ($length) | |
returns 8-bit string or false on timeout or null on eof | |
write ($buffer, $length=null) | |
returns number of written bytes or false on timeout | |
isTimedOut () | |
shutdownInput () | |
| |
shutdownOutput () | |
| |
close () | |
| |
Static Public Member Functions | |
static | create () |
| |
Public Attributes | |
const | DEFAULT_TIMEOUT = 1000 |
const | EAGAIN = 11 |
Private Member Functions | |
checkRead () | |
checkWrite () | |
Static Private Member Functions | |
static | getSeconds ($timeout) |
static | getMicroseconds ($timeout) |
Private Attributes | |
$socket = null | |
$connected = false | |
$host = null | |
$port = null | |
$inputStream = null | |
$outputStream = null | |
$closed = false | |
$inputShutdown = false | |
$outputShutdown = false | |
$readTimeout = null | |
$writeTimeout = null |
Definition at line 16 of file Socket.class.php.
Socket::__construct | ( | ) |
Definition at line 39 of file Socket.class.php.
Socket::__destruct | ( | ) |
Definition at line 54 of file Socket.class.php.
References close().
static Socket::create | ( | ) | [static] |
Socket::setHost | ( | $ | host | ) |
Definition at line 76 of file Socket.class.php.
References $host, and Assert::isNull().
Socket::getHost | ( | ) |
Definition at line 85 of file Socket.class.php.
Socket::setPort | ( | $ | port | ) |
Definition at line 93 of file Socket.class.php.
References $port, and Assert::isNull().
Socket::getPort | ( | ) |
Definition at line 102 of file Socket.class.php.
Socket::isConnected | ( | ) |
Definition at line 107 of file Socket.class.php.
Socket::getInputStream | ( | ) |
Definition at line 115 of file Socket.class.php.
References checkRead().
Socket::getOutputStream | ( | ) |
Definition at line 125 of file Socket.class.php.
References checkWrite().
Socket::connect | ( | $ | connectTimeout = self::DEFAULT_TIMEOUT |
) |
Definition at line 135 of file Socket.class.php.
References Assert::isTrue(), setReadTimeout(), and setWriteTimeout().
Socket::setReadTimeout | ( | $ | timeout | ) |
Definition at line 197 of file Socket.class.php.
Referenced by connect(), and setTimeout().
Socket::setWriteTimeout | ( | $ | timeout | ) |
Definition at line 214 of file Socket.class.php.
Referenced by connect(), and setTimeout().
Socket::setTimeout | ( | $ | timeout | ) |
Definition at line 231 of file Socket.class.php.
References setReadTimeout(), and setWriteTimeout().
Socket::getReadTimeout | ( | ) |
Definition at line 240 of file Socket.class.php.
Socket::getWriteTimeout | ( | ) |
Definition at line 248 of file Socket.class.php.
Socket::read | ( | $ | length | ) |
returns 8-bit string or false on timeout or null on eof
Definition at line 258 of file Socket.class.php.
References checkRead(), and isTimedOut().
Referenced by checkRead().
Socket::write | ( | $ | buffer, | |
$ | length = null | |||
) |
returns number of written bytes or false on timeout
Definition at line 285 of file Socket.class.php.
References checkWrite(), and isTimedOut().
Referenced by checkWrite().
Socket::isTimedOut | ( | ) |
Socket::shutdownInput | ( | ) |
Socket::shutdownOutput | ( | ) |
Socket::close | ( | ) |
Definition at line 343 of file Socket.class.php.
References shutdownInput(), and shutdownOutput().
Referenced by __destruct().
static Socket::getSeconds | ( | $ | timeout | ) | [static, private] |
Definition at line 358 of file Socket.class.php.
static Socket::getMicroseconds | ( | $ | timeout | ) | [static, private] |
Definition at line 363 of file Socket.class.php.
Socket::checkRead | ( | ) | [private] |
Definition at line 368 of file Socket.class.php.
References read().
Referenced by getInputStream(), and read().
Socket::checkWrite | ( | ) | [private] |
Definition at line 377 of file Socket.class.php.
References write().
Referenced by getOutputStream(), and write().
const Socket::DEFAULT_TIMEOUT = 1000 |
Definition at line 18 of file Socket.class.php.
const Socket::EAGAIN = 11 |
Definition at line 20 of file Socket.class.php.
Socket::$socket = null [private] |
Definition at line 22 of file Socket.class.php.
Socket::$connected = false [private] |
Definition at line 23 of file Socket.class.php.
Socket::$host = null [private] |
Socket::$port = null [private] |
Socket::$inputStream = null [private] |
Definition at line 28 of file Socket.class.php.
Socket::$outputStream = null [private] |
Definition at line 29 of file Socket.class.php.
Socket::$closed = false [private] |
Definition at line 31 of file Socket.class.php.
Socket::$inputShutdown = false [private] |
Definition at line 32 of file Socket.class.php.
Socket::$outputShutdown = false [private] |
Definition at line 33 of file Socket.class.php.
Socket::$readTimeout = null [private] |
Definition at line 36 of file Socket.class.php.
Socket::$writeTimeout = null [private] |
Definition at line 37 of file Socket.class.php.