Loading...
Searching...
No Matches
BALL::TCPServer Class Reference

`#include <BALL/SYSTEM/networking.h>`

Inheritance diagram for BALL::TCPServer:

## Public Member Functions

| TCPServer (Size port, bool restart=true)
virtual | ~TCPServer ()
virtual void | activate ()
virtual void | deactivate ()
virtual void | startAccepting ()
virtual void | handleConnection ()
virtual void | connectionRequested ()
void | setPort (Size port)
Size | getPort () const

## Protected Attributes

Size | port_
bool | restart_
TCPIOStream | connected_stream_
boost::asio::io_context | io_service_
boost::asio::ip::tcp::acceptor | acceptor_

## Detailed Description

This class provides a base for very simple TCP-based servers.

By default, the server handles only one connection. The first request is accepted and converted into a TCPIOStream. If restart_ is set to true (default), the server listens again after the connection has been terminated.

Note that the server is not automatically started but rather waits for a call to "run".

Definition at line 60 of file networking.h.

## Constructor & Destructor Documentation

## TCPServer()

BALL::TCPServer::TCPServer | ( | Size | port,
|  | bool | restart = true )

inline

Definition at line 63 of file networking.h.

## ~TCPServer()

virtual BALL::TCPServer::~TCPServer | ( |  | ) |

virtual

## Member Function Documentation

## activate()

virtual void BALL::TCPServer::activate | ( |  | ) |

virtual

## connectionRequested()

virtual void BALL::TCPServer::connectionRequested | ( |  | ) |

virtual

## deactivate()

virtual void BALL::TCPServer::deactivate | ( |  | ) |

virtual

Reimplemented in BALL::TCPServerThread.

## getPort()

Size BALL::TCPServer::getPort | ( |  | ) | const

## handleConnection()

virtual void BALL::TCPServer::handleConnection | ( |  | ) |

virtual

Reimplemented in BALL::VIEW::ServerWidget::BALLViewServer.

## setPort()

void BALL::TCPServer::setPort | ( | Size | port | ) |

## startAccepting()

virtual void BALL::TCPServer::startAccepting | ( |  | ) |

virtual

## Member Data Documentation

## acceptor_

boost::asio::ip::tcp::acceptor BALL::TCPServer::acceptor_

protected

Definition at line 91 of file networking.h.

## connected_stream_

TCPIOStream BALL::TCPServer::connected_stream_

protected

Definition at line 87 of file networking.h.

## io_service_

boost::asio::io_context BALL::TCPServer::io_service_

protected

Definition at line 89 of file networking.h.

## port_

Size BALL::TCPServer::port_

protected

Definition at line 84 of file networking.h.

## restart_

bool BALL::TCPServer::restart_

protected

Definition at line 85 of file networking.h.