Poco::RemotingNG::TCP

class Listener

Library: RemotingNG/TCP
Package: TCP
Header: Poco/RemotingNG/TCP/Listener.h

Description

The RemotingNG Listener implementation for the TCP transport.

Inheritance

Direct Base Classes: Poco::RemotingNG::EventListener

All Base Classes: Poco::RefCountedObject, Poco::RemotingNG::EventListener, Poco::RemotingNG::Listener

Member Summary

Member Functions: connectionManager, createURI, defaultListener, findEventSubscriber, getEventSubscriptionTimeout, getTimeout, handlesURI, makeDefaultListener, protocol, registerEventFrameHandler, registerObject, setEventSubscriptionTimeout, setTimeout, start, stop, subscribeToEvents, unregisterObject, unsubscribeFromEvents

Inherited Functions: createURI, duplicate, endPoint, getAuthenticator, getAuthorizer, handlesURI, protocol, referenceCount, registerObject, release, setAuthenticator, setAuthorizer, start, stop, subscribeToEvents, unregisterObject, unsubscribeFromEvents

Types

Ptr

typedef Poco::AutoPtr < Listener > Ptr;

Constructors

Listener

Listener(
    ConnectionManager & connectionManager = ConnectionManager::defaultManager ()
);

Creates a passive Event Listener.

This method is used to set up a passive Event Listener on the client. No TCPServer will be created.

There must not be more than one passive Event Listener per Connection. A single instance can be used for all connections an application uses. The defaultListener() method can be used to obtain such a shared Event Listener object. Creating the Event Listener explicitly is not recommended, unless a non-default ConnectionManager has to be used.

Listener

Listener(
    const std::string & endPoint,
    ConnectionManager & connectionManager = ConnectionManager::defaultManager ()
);

Creates a Listener for the given endpoint, which must be in <host>:<port> format.

This method will create a Poco::Net::ServerSocket, bind it to the given endpoint address, and set up a TCPServer instance for accepting incoming connections.

Listener

Listener(
    const std::string & endPoint,
    Poco::Net::TCPServerParams::Ptr pParams,
    ConnectionManager & connectionManager = ConnectionManager::defaultManager ()
);

Creates a Listener for the given endpoint, which must be in <host>:<port> format.

This method will create a Poco::Net::ServerSocket, bind it to the given endpoint address, and set up a TCPServer instance (using the given params) for accepting incoming connections.

Listener

Listener(
    const std::string & endPoint,
    const Poco::Net::ServerSocket & socket,
    Poco::Net::TCPServerParams::Ptr pParams,
    ConnectionManager & connectionManager = ConnectionManager::defaultManager ()
);

Creates a Listener for the given endpoint, which must be in <host>:<port> format.

This method will use the given server socket, and set up a TCPServer instance (using the given params) for accepting incoming connections.

Note that the given server socket can be a Poco::Net::SecureServerSocket in order to set up a secure connection.

Destructor

~Listener virtual

~Listener();

Destroys the Listener.

Member Functions

connectionManager

ConnectionManager & connectionManager();

Returns the ConnectionManager used by the Listener.

createURI

std::string createURI(
    const Poco::RemotingNG::Identifiable::TypeId & typeId,
    const Poco::RemotingNG::Identifiable::ObjectId & objectId
);

defaultListener static

static Ptr defaultListener();

Returns the Listener instance used for event subscriptions.

The first call to this method will create the default Listener instance, using the default ConnectionManager.

defaultListener static

static Ptr defaultListener(
    ConnectionManager & cm
);

Returns the Listener instance used for event subscriptions.

The first call to this method (unless the no-argument version has been called first) will create the default Listener instance using the given ConnectionManager. Subsequent calls to this method must specify the same ConnectionManager instance or use the no-argument version. Specifying a different ConnectionManager instance in a subsequent call will result in a Poco::IllegalStateException being thrown.

findEventSubscriber

Poco::RemotingNG::EventSubscriber::Ptr findEventSubscriber(
    const std::string & path
) const;

getEventSubscriptionTimeout

Poco::Timespan getEventSubscriptionTimeout() const;

Returns the timeout for event subscriptions.

getTimeout

Poco::Timespan getTimeout() const;

Returns the receive timeout for connections.

handlesURI virtual

bool handlesURI(
    const std::string & uri
);

makeDefaultListener

void makeDefaultListener();

Makes the Listener the default Listener, returned by defaultListener().

Can only be called if there is no default Listener already set, or, in other words, if defaultListener() has not been called yet.

Throws a Poco::IllegalStateException if another default Listener has already been set.

protocol virtual

const std::string & protocol() const;

registerObject

void registerObject(
    Poco::RemotingNG::RemoteObject::Ptr pRemoteObject,
    Poco::RemotingNG::Skeleton::Ptr pSkeleton
);

setEventSubscriptionTimeout

void setEventSubscriptionTimeout(
    Poco::Timespan timeout
);

Sets the timeout for event subscriptions.

setTimeout

void setTimeout(
    Poco::Timespan timeout
);

Sets the receive timeout for connections.

start virtual

void start();

stop virtual

void stop();

subscribeToEvents

std::string subscribeToEvents(
    Poco::RemotingNG::EventSubscriber::Ptr pEventSubscriber
);

unregisterObject

void unregisterObject(
    Poco::RemotingNG::RemoteObject::Ptr pRemoteObject
);

unsubscribeFromEvents

void unsubscribeFromEvents(
    Poco::RemotingNG::EventSubscriber::Ptr pEventSubscriber
);

registerEventFrameHandler protected

void registerEventFrameHandler(
    Connection::Ptr pConnection
);

Variables

connectionAccepted

Poco::BasicEvent < Connection::Ptr > connectionAccepted;

Fired when a new client connection has been accepted.