VideoTools
|
An abstract interface for reading and writing from a non-blocking i/o channel. More...
#include <greadwrite.h>
Public Types | |
typedef size_t | size_type |
typedef ssize_t | ssize_type |
Public Member Functions | |
virtual ssize_type | read (char *buffer, size_type buffer_length)=0 |
Reads data. More... | |
virtual ssize_type | write (const char *buf, size_type len)=0 |
Sends data. More... | |
virtual bool | eWouldBlock ()=0 |
See read() and write(). | |
virtual SOCKET | fd () const =0 |
Returns the file descriptor. | |
virtual | ~ReadWrite () |
Destructor. | |
An abstract interface for reading and writing from a non-blocking i/o channel.
Eg:
Definition at line 49 of file greadwrite.h.
|
pure virtual |
Reads data.
Returns 0 if the connection has been lost. Returns -1 on error or if there is nothing to read (in which case eWouldBlock() returns true).
Implemented in GNet::DatagramSocket, GNet::StreamSocket, and GNet::Socket.
|
pure virtual |
Sends data.
Returns the amount of data sent.
If this method returns -1 then use eWouldBlock() to determine whether there was a flow control problem; if it returns -1 and eWouldBlock() returns false then the connection is lost. If it returns less than the requested length then eWouldBlock() should not be used.
Implemented in GNet::DatagramSocket, GNet::StreamSocket, and GNet::Socket.