Public Member Functions | |
__construct (Socket $socket) | |
isEof () | |
read ($length) | |
reads a maximum of $length bytes | |
Public Attributes | |
const | READ_ATTEMPTS = 15 |
NOTE: if socket timeout is 1 second, we can block here over abt 15 seconds. | |
Protected Attributes | |
$eof = false | |
Private Attributes | |
$socket = null |
Definition at line 16 of file SocketInputStream.class.php.
SocketInputStream::__construct | ( | Socket $ | socket | ) |
Definition at line 32 of file SocketInputStream.class.php.
SocketInputStream::isEof | ( | ) |
SocketInputStream::read | ( | $ | length | ) |
reads a maximum of $length bytes
returns null on eof or if length == 0. Otherwise MUST return at least one byte or throw IOException
NOTE: if length is too large to read all data at once and eof has not been reached, it MUST BLOCK until all data is read or eof is reached or throw IOException.
It is abnormal state. Maybe you should use some kind of non-blocking channels instead?
Reimplemented from InputStream.
Definition at line 42 of file SocketInputStream.class.php.
const SocketInputStream::READ_ATTEMPTS = 15 |
NOTE: if socket timeout is 1 second, we can block here over abt 15 seconds.
See conventions of InputStream.
You must set reliable timeout for socket operations if you want to avoid fatal error on max_execution_time and you must make sure the length is not too large to read it at once from your physical channel.
Definition at line 27 of file SocketInputStream.class.php.
SocketInputStream::$socket = null [private] |
Definition at line 29 of file SocketInputStream.class.php.
SocketInputStream::$eof = false [protected] |
Definition at line 30 of file SocketInputStream.class.php.