File descriptor support module.
The handler within this module allows you to react to events on file descriptors created in your application. Set up a network socket and then watch the fd number with the watch_* methods of the fd_handler. Watched sockets cause reaction events within the EOS agent asynchronous event loop.
This class manages file descriptors within the event loop context.
There are two main components to handling file* descriptors. The ‘watch_*()’ register a file descriptor to react to events on the descriptor state. The ‘on_*()’ methods should be overridden to actually handle these changes to the file descriptor’s state. For example if you’re managing a network connection with a client, invoking ‘watch_readable(fd, true)’ will cause ‘on_readable(fd)’ to be called whenever data has been received.
Note that it is not necessary to always watch_*() attributes of a file descriptor, that is, you are free to write to a socket even if watch_writeable has not been set. Continuing with the network connection example, on_writeable will be continuously called when ‘watch_writeable(fd, true)’ is set, as the descriptor is almost always writeable. If the other side of the connection overruns its TCP backlog, though, your descriptor will return an error on write, indicating that the socket is no longer writeable, and it is at that point that ‘watch_writeable(fd, true)’ should be invoked. When the other end of the connection
Public Functions
Creates a file descriptor handler, which can react to any number of FDs.
Called when the file descriptor number is readable.
Called when the file descriptor number is writable.
Called when the file descriptor number has exceptions.
Notifies this handler when the passed file descriptor is readable.
Notifies this handler when the passed file descriptor is writable.
Notifies this handler when the passed file descriptor has exceptions.
Private Members