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 15 of file Socket.class.php.
Socket::__construct | ( | ) |
Definition at line 38 of file Socket.class.php.
Socket::__destruct | ( | ) |
Definition at line 53 of file Socket.class.php.
References close().
Socket::checkRead | ( | ) | [private] |
Definition at line 367 of file Socket.class.php.
Referenced by getInputStream(), and read().
Socket::checkWrite | ( | ) | [private] |
Definition at line 376 of file Socket.class.php.
Referenced by getOutputStream(), and write().
Socket::close | ( | ) |
Definition at line 342 of file Socket.class.php.
References shutdownInput(), and shutdownOutput().
Referenced by __destruct().
Socket::connect | ( | $ | connectTimeout = self::DEFAULT_TIMEOUT |
) |
Definition at line 134 of file Socket.class.php.
References Assert::isTrue(), setReadTimeout(), and setWriteTimeout().
static Socket::create | ( | ) | [static] |
Definition at line 67 of file Socket.class.php.
Socket::getHost | ( | ) |
Definition at line 84 of file Socket.class.php.
Socket::getInputStream | ( | ) |
Definition at line 114 of file Socket.class.php.
References checkRead().
static Socket::getMicroseconds | ( | $ | timeout | ) | [static, private] |
Definition at line 362 of file Socket.class.php.
Socket::getOutputStream | ( | ) |
Definition at line 124 of file Socket.class.php.
References checkWrite().
Socket::getPort | ( | ) |
Definition at line 101 of file Socket.class.php.
Socket::getReadTimeout | ( | ) |
Definition at line 239 of file Socket.class.php.
static Socket::getSeconds | ( | $ | timeout | ) | [static, private] |
Definition at line 357 of file Socket.class.php.
Socket::getWriteTimeout | ( | ) |
Definition at line 247 of file Socket.class.php.
Socket::isConnected | ( | ) |
Definition at line 106 of file Socket.class.php.
Socket::isTimedOut | ( | ) |
Definition at line 310 of file Socket.class.php.
Socket::read | ( | $ | length | ) |
returns 8-bit string or false on timeout or null on eof
Definition at line 257 of file Socket.class.php.
References checkRead(), and isTimedOut().
Socket::setHost | ( | $ | host | ) |
Definition at line 75 of file Socket.class.php.
References $host, and Assert::isNull().
Socket::setPort | ( | $ | port | ) |
Definition at line 92 of file Socket.class.php.
References $port, and Assert::isNull().
Socket::setReadTimeout | ( | $ | timeout | ) |
Definition at line 196 of file Socket.class.php.
Referenced by connect(), and setTimeout().
Socket::setTimeout | ( | $ | timeout | ) |
Definition at line 230 of file Socket.class.php.
References setReadTimeout(), and setWriteTimeout().
Socket::setWriteTimeout | ( | $ | timeout | ) |
Definition at line 213 of file Socket.class.php.
Referenced by connect(), and setTimeout().
Socket::shutdownInput | ( | ) |
Socket::shutdownOutput | ( | ) |
Socket::write | ( | $ | buffer, | |
$ | length = null | |||
) |
returns number of written bytes or false on timeout
Definition at line 284 of file Socket.class.php.
References checkWrite(), and isTimedOut().
Socket::$closed = false [private] |
Definition at line 30 of file Socket.class.php.
Socket::$connected = false [private] |
Definition at line 22 of file Socket.class.php.
Socket::$host = null [private] |
Definition at line 24 of file Socket.class.php.
Referenced by setHost().
Socket::$inputShutdown = false [private] |
Definition at line 31 of file Socket.class.php.
Socket::$inputStream = null [private] |
Definition at line 27 of file Socket.class.php.
Socket::$outputShutdown = false [private] |
Definition at line 32 of file Socket.class.php.
Socket::$outputStream = null [private] |
Definition at line 28 of file Socket.class.php.
Socket::$port = null [private] |
Definition at line 25 of file Socket.class.php.
Referenced by setPort().
Socket::$readTimeout = null [private] |
Definition at line 35 of file Socket.class.php.
Socket::$socket = null [private] |
Definition at line 21 of file Socket.class.php.
Socket::$writeTimeout = null [private] |
Definition at line 36 of file Socket.class.php.
const Socket::DEFAULT_TIMEOUT = 1000 |
Definition at line 17 of file Socket.class.php.
const Socket::EAGAIN = 11 |
Definition at line 19 of file Socket.class.php.