You are here

function Net_Socket::setBlocking in Flickr API 5

Sets whether the socket connection should be blocking or not. A read call to a non-blocking socket will return immediately if there is no data available, whereas it will block until there is data for blocking sockets.

@access public

Parameters

boolean $mode True for blocking sockets, false for nonblocking.:

Return value

mixed true on success or an error object otherwise

1 call to Net_Socket::setBlocking()
Net_Socket::connect in phpFlickr/PEAR/Net/Socket.php
Connect to the specified port. If called when the socket is already connected, it disconnects and connects again.

File

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

Class

Net_Socket
Generalized Socket class.

Code

function setBlocking($mode) {
  if (!is_resource($this->fp)) {
    return $this
      ->raiseError('not connected');
  }
  $this->blocking = $mode;
  socket_set_blocking($this->fp, $this->blocking);
  return true;
}