You are here

function Net_Socket::readString in Flickr API 5

Reads a zero-terminated string of data

@access public

Return value

string, or a PEAR_Error if not connected.

File

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

Class

Net_Socket
Generalized Socket class.

Code

function readString() {
  if (!is_resource($this->fp)) {
    return $this
      ->raiseError('not connected');
  }
  $string = '';
  while (($char = @fread($this->fp, 1)) != "\0") {
    $string .= $char;
  }
  return $string;
}