Class Connector

Inheritance Relationships

Derived Types

Class Documentation

class Connector

Abstract base class for all connector.

The base server defines common methods for all servers and allows different server types to be easily swapped out. The base server holds a nng_socket object and string error.

Subclassed by O3DS::AsyncConnector, O3DS::BlockingNngConnector

Public Types

enum eState


enumerator NOTSTARTED
enumerator STARTED
enumerator READING
enumerator STATE_ERROR
enumerator CLOSED

Public Functions

virtual ~Connector()
virtual bool start(const char *url) = 0

Starts the connector, often using nng_dial or nng_listen.

virtual bool write(const char *data, size_t len) = 0

Write bytes - len is the size of data.

virtual size_t read(char *data, size_t len) = 0

Read bytes - len is the fixed size of buffer, returns the number of bytes read.

virtual size_t read(char **data, size_t *len) = 0

Read a message, realloc and rezie *data if needed. If the buffer is reszied, len will be updated. Returns the size of the message, which may be less than the buffer size

inline enum eState getState()
const std::string &getError()
void setError(const char *msg)

Protected Attributes

enum eState mState
std::string mError