class Poco::Net::TCPServerConnection

Overview

The abstract base class for TCP server connections created by TCPServer. Moreā€¦

#include <TCPServerConnection.h>

class TCPServerConnection: public Poco::Runnable
{
public:
    // construction

    TCPServerConnection(const StreamSocket& socket);

protected:
    // methods

    StreamSocket&
    socket();

    void
    start();
};

// direct descendants

class HTTPServerConnection;

Inherited Members

public:
    // methods

    virtual
    void
    run() = 0;

Detailed Documentation

The abstract base class for TCP server connections created by TCPServer.

Derived classes must override the run() method (inherited from Runnable). Furthermore, a TCPServerConnectionFactory must be provided for the subclass.

The run() method must perform the complete handling of the client connection. As soon as the run() method returns, the server connection object is destroyed and the connection is automatically closed.

A new TCPServerConnection object will be created for each new client connection that is accepted by TCPServer.

Construction

TCPServerConnection(const StreamSocket& socket)

Creates the TCPServerConnection using the given stream socket.

Methods

StreamSocket&
socket()

Returns a reference to the underlying socket.

void
start()

Calls run() and catches any exceptions that might be thrown by run().