# 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, dispatch, hasObserver, hasObservers, removeObserver

Inherited Functions: duplicate, referenceCount, release

## Constructors

### SocketNotifier

explicit SocketNotifier(
const Socket & socket
);

Creates the SocketNotifier for the given socket.

## Destructor

### ~SocketNotifier

~SocketNotifier();

Destroys the SocketNotifier.

## Member Functions

### accepts

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

std::size_t countObservers() const;

Returns the number of subscribers;

### dispatch

void dispatch(
SocketNotification * pNotification
);

Dispatches the notification to all observers.

### hasObserver

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

Returns true if the given observer is registered.

### hasObservers

bool hasObservers() const;

Returns true if there are subscribers.

### removeObserver

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

Removes the given observer.