Abstracts the socket file descriptor set for select() or poll() calls.
More...
#include <UT_NetFDSet.h>
Abstracts the socket file descriptor set for select() or poll() calls.
- Examples:
- mocapstream/MocapStreamRokokoHDK.C.
Definition at line 51 of file UT_NetFDSet.h.
Constructor and desctructor.
- Parameters
-
fast | This informs the fd set to use the performant variant for the platform. This is currently only support on some platforms. |
mode | The mode to run the fd set in. |
UT_NetFDSet::~UT_NetFDSet |
( |
| ) |
|
Adds a file descriptor to the set with the intent of monitoring a set of given IO events.
int UT_NetFDSet::checkEvents |
( |
int |
timeout_ms | ) |
const |
Checks or waits for the IO events on the file descriptors in the set. Essentially it's a wrapper for select() or poll().
- Parameters
-
timeout_ms | The timeout to wait for connection (in miliseconds). If zero, the call does not wait for the events, but instead checks for the current state of the FDs in the set. If negative, the call blocks indefinitely, waiting for the first event. This is equivalent to passing NULL to select() or -1 to poll() as time value. |
- Returns
- The total number of file descriptors on which there was activitiy (events of the registered type), or -1 if error occured. If time limit expires, returns 0.
- Examples:
- mocapstream/MocapStreamRokokoHDK.C.
bool UT_NetFDSet::contains |
( |
int |
fd | ) |
const |
Test whether a file descriptor is in the set.
Get all events current events in the set. This will wait up to timeout_ms before returning.
- Parameters
-
events | The list of all current events in the set. The size of the array is 0..number of fd in set. |
timeout_ms | The maximum amount of time to wait before givin up. The timeout is in ms. |
- Returns
- True if
events
has any events in the list.
bool UT_NetFDSet::getInfoWithFD |
( |
int |
fd, |
|
|
EventInfo & |
info |
|
) |
| const |
Get all IO activity from an fd. Returns false if something has gone wrong.
- Parameters
-
fd | This is the file descriptor to get the io information for. |
info | This is the information about a IO activity from the file descriptor provided. |
Returns true if there was any IO activity of the given type on the given file descriptor.
bool UT_NetFDSet::isEmpty |
( |
| ) |
const |
Returns true if the set contains no file descriptors.
Modify a file descriptor flags.
Remove a file descriptor from the set.
void UT_NetFDSet::removeAll |
( |
| ) |
|
Removes all added file descriptors for all events (resets the set).
In some cases the mode wont be decided until after the fd set is created. The mode CANNOT be changed while the fdset has fd in it!
- Parameters
-
mode | The mode to run the fd set in. |
Definition at line 141 of file UT_NetFDSet.h.
const int UT_NetFDSet::INDEFINITE_WAIT |
|
static |
const int UT_NetFDSet::NO_WAIT |
|
static |
The documentation for this class was generated from the following file: