You are here

function Net_Socket::readAll in Flickr API 5

Read until the socket closes, or until there is no more data in the inner PHP buffer. If the inner buffer is empty, in blocking mode we wait for at least 1 byte of data. Therefore, in blocking mode, if there is no data at all to be read, this function will never exit (unless the socket is closed on the remote end).

@access public

Return value

string All data until the socket closes, or a PEAR_Error if not connected.

File

phpFlickr/PEAR/Net/Socket.php, line 467

Class

Net_Socket
Generalized Socket class.

Code

function readAll() {
  if (!is_resource($this->fp)) {
    return $this
      ->raiseError('not connected');
  }
  $data = '';
  while (!feof($this->fp)) {
    $data .= @fread($this->fp, $this->lineLength);
  }
  return $data;
}