You are here

function Net_Socket::read in Flickr API 5

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.

@access public

Parameters

integer $size The number of bytes to read from the socket.:

Return value

$size bytes of data from the socket, or a PEAR_Error if not connected.

File

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

Class

Net_Socket
Generalized Socket class.

Code

function read($size) {
  if (!is_resource($this->fp)) {
    return $this
      ->raiseError('not connected');
  }
  return @fread($this->fp, $size);
}