Poco::Net

class SocketNotifier

Library: Net
Package: Reactor
Header: Poco/Net/SocketNotifier.h

Description

This class is used internally by SocketReactor to notify registered event handlers of socket events.

Inheritance

Direct Base Classes: Poco::RefCountedObject

All Base Classes: Poco::RefCountedObject

Member Summary

Member Functions: accepts, addObserver, countObservers, disableObservers, dispatch, hasObserver, hasObservers, removeObserver, socket

Inherited Functions: duplicate, referenceCount, release

Constructors

SocketNotifier

explicit SocketNotifier(
    const Socket & socket
);

Creates the SocketNotifier for the given socket.

Destructor

~SocketNotifier protected virtual

~SocketNotifier() override;

Destroys the SocketNotifier.

Member Functions

accepts inline

bool accepts(
    SocketNotification * pNotification
);

Returns true if there is at least one observer for the given notification.

addObserver

void addObserver(
    SocketReactor * pReactor,
    const Poco::AbstractObserver & observer
);

Adds the given observer.

countObservers inline

std::size_t countObservers() const;

Returns the number of subscribers;

disableObservers

void disableObservers();

Disables all observers, preventing any further handler calls even if notifications are in flight.

dispatch

void dispatch(
    SocketNotification * pNotification
);

Dispatches the notification to all observers.

hasObserver inline

bool hasObserver(
    const Poco::AbstractObserver & observer
) const;

Returns true if the given observer is registered.

hasObservers inline

bool hasObservers() const;

Returns true if there are subscribers.

removeObserver

void removeObserver(
    SocketReactor * pReactor,
    const Poco::AbstractObserver & observer
);

Removes the given observer.

socket inline

Socket socket() const;

Returns the socket.