|
E-MailRelay
|
An abstract interface for reading and writing from a non-blocking i/o channel. More...
#include <greadwrite.h>
Inheritance diagram for G::ReadWrite:Public Types | |
| using | size_type = std::size_t |
| using | ssize_type = ssize_t |
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 () const =0 |
| See read() and write(). More... | |
| virtual SOCKET | fd () const noexcept=0 |
| Returns the file descriptor. More... | |
| virtual | ~ReadWrite ()=default |
| Destructor. | |
An abstract interface for reading and writing from a non-blocking i/o channel.
Eg:
Definition at line 49 of file greadwrite.h.
| using G::ReadWrite::size_type = std::size_t |
Definition at line 52 of file greadwrite.h.
| using G::ReadWrite::ssize_type = ssize_t |
Definition at line 53 of file greadwrite.h.
|
pure virtual |
Implemented in GNet::SocketBase.
|
pure virtualnoexcept |
Returns the file descriptor.
Implemented in GNet::SocketBase.
|
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::StreamSocket, GNet::RawSocket, and GNet::DatagramSocket.
|
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::StreamSocket, GNet::RawSocket, and GNet::DatagramSocket.