Public Member Functions | Public Attributes | Private Attributes

SocketInputStream Class Reference
[Various accompanying utilities]

Inheritance diagram for SocketInputStream:
Inheritance graph
[legend]

List of all members.

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.

Private Attributes

 $socket = null
 $eof = false

Detailed Description

Definition at line 15 of file SocketInputStream.class.php.


Constructor & Destructor Documentation

SocketInputStream::__construct ( Socket socket  ) 

Definition at line 31 of file SocketInputStream.class.php.


Member Function Documentation

SocketInputStream::isEof (  ) 

Reimplemented from InputStream.

Definition at line 36 of file SocketInputStream.class.php.

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 41 of file SocketInputStream.class.php.


Member Data Documentation

SocketInputStream::$eof = false [private]

Definition at line 29 of file SocketInputStream.class.php.

SocketInputStream::$socket = null [private]

Definition at line 28 of file SocketInputStream.class.php.

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 26 of file SocketInputStream.class.php.


The documentation for this class was generated from the following file: