# Poco::Net

# class TCPServerConnection

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

## Description

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.

## Inheritance

Direct Base Classes: Poco::Runnable

All Base Classes: Poco::Runnable

Known Derived Classes: HTTPServerConnection

## Member Summary

Member Functions: socket, start

Inherited Functions: run

## Constructors

### TCPServerConnection

TCPServerConnection(
const StreamSocket & socket
);

Creates the TCPServerConnection using the given stream socket.

## Destructor

### ~TCPServerConnection

virtual ~TCPServerConnection();

Destroys the TCPServerConnection.

## Member Functions

### socket

StreamSocket & socket();

Returns a reference to the underlying socket.

### start

void start();

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