ConnectedClient

class kanzi::connect::ConnectedClient : public enable_shared_from_this<ConnectedClient>

Class that represents one client on server-side.

Acts as a gateway to client and makes it possible to transmit messages between client and server.

Subclassed by ConnectedClientProxy

Public Types

enum Role

Values:

enumerator RoleClient
enumerator RoleServer
typedef enum kanzi::connect::ConnectedClient::Role Role

Public Functions

ConnectedClient(shared_ptr<MessageDispatcher> dispatcher, int id = -1)

Constructor.

Parameters
  • dispatcher: Message dispatcher, used to send messages in to this client instance.

  • id: Id of the client.

~ConnectedClient()

Destructor.

const string &getAddress() const

Retrieves ip address of the client.

Return

IP address of the client, as string.

int64_t getFirstMessageWaitTimerHandle() const

get handle used to track first message

Return

handle

int getId() const

Return the internally hold ID, -1 if not configured.

Return

client identifier number.

shared_ptr<MessageDispatcher> getMessageDispatcher()

Retrieves message dispatcher of this client.

Return

Message dispatcher for this client.

const string &getName() const

Retrieves name of the client.

Return

Name of the client.

const string &getProtocol() const

Retrieves the protocol assigned to a client connection.

Return

the protocol, e.g. “connect.bearer.tcp”, “connect.bearer.ssl”, “http”, “https”, ..

Role getRole() const

Retrieves the role of an object.

Return

the role

void setAddress(const string &address)

Sets IP address for a client.

Parameters
  • address: New IP address for client.

void setFirstMessageWaitTimerHandle(int64_t handle)

Store a handle used to track first message.

Parameters
  • handle: the handle

void setName(const string &name)

Sets name for a client.

Parameters
  • name: New name for client.

void setProtocol(const string &protocol)

Sets the protocol for the client.

Parameters
  • protocol: the protocol

void setRole(Role role)

Configure the role.

Parameters
  • role: the role.

string toString() const

Get textual information of the client to for example logging purposes.

Return

human readable information about the object.