You are here

function Net_Socket::readIPAddress in Flickr API 5

Reads an IP Address and returns it in a dot formated string

@access public

Return value

Dot formated string, or a PEAR_Error if not connected.

File

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

Class

Net_Socket
Generalized Socket class.

Code

function readIPAddress() {
  if (!is_resource($this->fp)) {
    return $this
      ->raiseError('not connected');
  }
  $buf = @fread($this->fp, 4);
  return sprintf("%s.%s.%s.%s", ord($buf[0]), ord($buf[1]), ord($buf[2]), ord($buf[3]));
}