module documentation
Utility functions for dealing with POSIX file descriptors.
Function | read |
Read from file descriptor, calling callback with resulting data. |
Function | set |
Set the file description of the given file descriptor to blocking. |
Function | set |
Set the file description of the given file descriptor to non-blocking. |
Function | write |
Write data to file descriptor. |
Variable | _set |
Undocumented |
Variable | _unset |
Undocumented |
Read from file descriptor, calling callback with resulting data.
If successful, call 'callback' with a single argument: the resulting data.
Returns same thing FileDescriptor.doRead would: CONNECTION_LOST, CONNECTION_DONE, or None.
Parameters | |
fd:int | non-blocking file descriptor to be read from. |
callback | a callable which accepts a single argument. If data is read from the file descriptor it will be called with this data. Handling exceptions from calling the callback is up to the caller. Note that if the descriptor is still connected but no data is read, None will be returned but callback will not be called. |
Returns | |
CONNECTION_LOST on error, CONNECTION_DONE when fd is closed, otherwise None. |