Public Member Functions |
virtual ssize_t | Send (const uint8_t *buffer, unsigned int size) |
virtual ssize_t | Send (IOQueue *data) |
virtual int | Receive (uint8_t *buffer, unsigned int size, unsigned int &data_read) |
virtual bool | SetReadNonBlocking () |
virtual bool | Close ()=0 |
int | DataRemaining () const |
bool | IsClosed () const |
void | SetOnClose (OnCloseCallback *on_close) |
OnCloseCallback * | TransferOnClose () |
void | SetOnData (ola::Callback0< void > *on_read) |
void | SetOnWritable (ola::Callback0< void > *on_write) |
void | PerformRead () |
void | PerformWrite () |
virtual int | ReadDescriptor () const =0 |
bool | ValidReadDescriptor () const |
virtual int | WriteDescriptor () const =0 |
bool | ValidWriteDescriptor () const |
Static Public Member Functions |
static bool | SetNonBlocking (int fd) |
Member Function Documentation
ssize_t ola::io::ConnectedDescriptor::Send |
( |
IOQueue * |
ioqueue | ) |
|
|
virtual |
Send an IOQueue. This attempts to send as much of the IOQueue data as possible. The IOQueue may be non-empty when this completes if the descriptor buffer is full.
- Returns
- the number of bytes sent.
This is a special method which transfers ownership of the on close handler away from the socket. Often when an on_close callback runs we want to delete the socket that it's bound to. This causes problems because we can't tell the difference between a normal deletion and a deletion triggered by a close, and the latter causes the callback to be deleted while it's running. To avoid this we we want to call the on close handler we transfer ownership away from the socket so doesn't need to delete the running handler.
The documentation for this class was generated from the following files: