Net_Socket::read()

Net_Socket::read() – retrieve data

Synopsis

require_once 'Net/Socket.php';

mixed Net_Socket::read ( integer $size )

Description

Read a specified amount of data. This is guaranteed to return, and has the added benefit of getting everything in one fread() chunk; if you know the size of the data you're getting beforehand, this is definitely the way to go.

Parameter

  • integer $size - maximum number of chars to recieve

Return value

mixed - the data or a PEAR_Error

Throws

Possible PEAR_Error values
Error code Error message Reason Solution
NULL "not connected" There is no open connection. You must establish a connection before ( Net_Socket::connect()).

Note

This function can not be called statically.