A class that asynchronously reads from a file descriptor. More...
#include <unix-fd-reader.h>
Classes | |
struct | Data |
Public Member Functions | |
void | Start (int fd, Callback< void, uint8_t *, ssize_t > readCallback) |
void | Stop (void) |
Protected Member Functions | |
virtual FdReader::Data | DoRead (void)=0 |
Protected Attributes | |
int | m_fd |
A class that asynchronously reads from a file descriptor.
This class can be used to start a system thread that reads from a given file descriptor and invokes a given callback when data is received. This class handles thread management automatically but the DoRead()
method must be implemented by a subclass.
void ns3::FdReader::Start | ( | int | fd, | |
Callback< void, uint8_t *, ssize_t > | readCallback | |||
) |
Start a new read thread.
fd | A valid file descriptor open for reading. | |
readCallback | A callback to invoke when new data is available. |
void ns3::FdReader::Stop | ( | void | ) |
Stop the read thread and reset internal state. This does not close the file descriptor used for reading.