Package pyxmpp2 :: Package mainloop :: Module interfaces :: Class IOHandler
[hide private]

Class IOHandler


Wrapper for a socket or a file descriptor to be used in event loop or for I/O threads.
Nested Classes [hide private]
  __metaclass__
Metaclass for defining Abstract Base Classes (ABCs).
Instance Methods [hide private]
 
fileno(self)
Return file descriptor to poll or select.
 
is_readable(self)
Returns: True when the I/O channel can be read
 
wait_for_readability(self)
Stop current thread until the channel is readable.
 
is_writable(self)
Returns: True when the I/O channel can be written to
IOHandlerPrepareResult
prepare(self)
Prepare the I/O handler for the event loop or an event loop iteration.
 
wait_for_writability(self)
Stop current thread until the channel is writable.
 
handle_write(self)
Handle the 'channel writable' state.
 
handle_read(self)
Handle the 'channel readable' state.
 
handle_hup(self)
Handle the 'channel hungup' state.
 
handle_err(self)
Handle an error reported.
 
handle_nval(self)
Handle an 'invalid file descriptor' event.
 
close(self)
Close the channell immediately, so it won't expect more events.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __abstractmethods__ = frozenset([])
  _abc_cache = <_weakrefset.WeakSet object at 0x871924c>
  _abc_negative_cache = <_weakrefset.WeakSet object at 0x871928c>
  _abc_negative_cache_version = 10
  _abc_registry = <_weakrefset.WeakSet object at 0x87191ec>
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

is_readable(self)

 
Returns:
True when the I/O channel can be read

wait_for_readability(self)

 
Stop current thread until the channel is readable.
Returns:
False if it won't be readable (e.g. is closed)

is_writable(self)

 
Returns:
True when the I/O channel can be written to

prepare(self)

 
Prepare the I/O handler for the event loop or an event loop iteration.
Returns: IOHandlerPrepareResult
HandlerReady() if there is no need to call prepare again or PrepareAgain() otherwise.

wait_for_writability(self)

 
Stop current thread until the channel is writable.
Returns:
False if it won't be readable (e.g. is closed)

handle_write(self)

 
Handle the 'channel writable' state. E.g. send buffered data via a socket.

handle_read(self)

 
Handle the 'channel readable' state. E.g. read from a socket.

handle_hup(self)

 
Handle the 'channel hungup' state. The handler should not be writtable after this.