SocketConnectionAdapter

class kanzi::connect::SocketConnectionAdapter : public ConnectionAdapter

A class that implements connection adapter for TCP-IP transport type.

Unnamed Group

virtual void configure (const ConnectionAdapter::Parameters &parameters) KZ_OVERRIDE

See

kanzi::connect::ConnectionAdapter

virtual void listen () KZ_OVERRIDE

Starts to listen for connections.

virtual void disconnect (size_t clientId) KZ_OVERRIDE

Terminates connection to given client.

If a file descriptor related to this client has been returned by the implementation then implementation must not closed the file descriptor. Instead it should mark the client disconnected and issue interrupt() call that will cause the disconnectPendingClients() to be invoked that can be used to close the file descriptors.

Parameters
  • clientId: Id of the client that will be disconnected.

virtual void wait () KZ_OVERRIDE

Starts blocking loop that waits for work, should preserve resources & CPU.

virtual void work () KZ_OVERRIDE

Performs all work that was received during the wait loop.

virtual void interrupt () KZ_OVERRIDE

Allows to interrupt the wait loop and return from the blocking loop.

virtual const string & getConnectionType () const KZ_OVERRIDE

Get the connection type identifier of this connection adapter.

Return

string which identifies the connection type (e.g. “socket”)

virtual unsigned int getMaximumConnectionCount () const KZ_OVERRIDE

Get maximum number of simultaneous connections for this adapters connection type.

See

getConnectionType

virtual const string getRemoteIPAddress (size_t handle) KZ_OVERRIDE

Gets the IP Address of the remote peer.

Return

IP address of the remote peer.

Parameters
  • handle: identifies the remote peer.

virtual void getClientSideParameters (vector< ClientSideParameter > &outputList) const KZ_OVERRIDE

Get list of parameters on the client side that are user configurable.

Parameters
  • outputList: Contains the parameters

Public Functions

explicit SocketConnectionAdapter(ClientIdManager &clientIdManager, int socketType)

Constructor.

Parameters
  • clientIdManager: entity used to allocate internal identifiers for communication

  • socketType: type of socket

virtual  ~SocketConnectionAdapter () KZ_OVERRIDE

Destructor.

virtual int getPort() const

Public Static Attributes

static const string PARAMETER_HOST_PORT

Configuration parameter, the port number of the listening socket.

static const string PARAMETER_INTERFACE_IP