class TCPServerConnectionFilter

Library: Net
Package: TCPServer
Header: Poco/Net/TCPServer.h


A TCPServerConnectionFilter can be used to reject incoming connections before passing them on to the TCPServerDispatcher and starting a thread to handle them.

An example use case is white-list or black-list IP address filtering.

Subclasses must override the accept() method.


Direct Base Classes: Poco::RefCountedObject

All Base Classes: Poco::RefCountedObject

Member Summary

Member Functions: accept

Inherited Functions: duplicate, referenceCount, release

Types Aliases


using Ptr = Poco::AutoPtr < TCPServerConnectionFilter >;


~TCPServerConnectionFilter protected virtual

virtual ~TCPServerConnectionFilter();

Member Functions

accept virtual

virtual bool accept(
    const StreamSocket & socket
) = 0;

Returns true if the given StreamSocket connection should be handled, and passed on to the TCPServerDispatcher.

Returns false if the socket should be closed immediately.

The socket can be prevented from being closed immediately if false is returned by creating a copy of the socket. This can be used to handle certain socket connections in a special way, outside the TCPServer framework.