HelloServer Class Reference

simple TCP server that just sends "Hello there!" to each connection More...

Inherits pion::tcp::server.

## Public Member Functions

| HelloServer (const unsigned int tcp_port)
virtual void | handle_connection (const tcp::connection_ptr &tcp_conn)
Public Member Functions inherited from pion::tcp::server
virtual | ~server ()
| default destructor
void | start (void)
| starts listening for new connections
void | stop (bool wait_until_finished=false)
void | join (void)
| the calling thread will sleep until the server has stopped listening for connections
void | set_ssl_key_file (const std::string &pem_key_file)
std::size_t | get_connections (void) const
| returns the number of active tcp connections
unsigned int | get_port (void) const
| returns tcp port number that the server listens for connections on
void | set_port (unsigned int p)
| sets tcp port number that the server listens for connections on
boost::asio::ip::address | get_address (void) const
| returns IP address that the server listens for connections on
void | set_address (const boost::asio::ip::address &addr)
| sets IP address that the server listens for connections on
const boost::asio::ip::tcp::endpoint & | get_endpoint (void) const
| returns tcp endpoint that the server listens for connections on
void | set_endpoint (const boost::asio::ip::tcp::endpoint &ep)
| sets tcp endpoint that the server listens for connections on
bool | get_ssl_flag (void) const
| returns true if the server uses SSL to encrypt connections
void | set_ssl_flag (bool b=true)
| sets value of SSL flag (true if the server uses SSL to encrypt connections)
connection::ssl_context_type & | get_ssl_context_type (void)
| returns the SSL context for configuration
bool | is_listening (void) const
| returns true if the server is listening for connections
void | set_logger (logger log_ptr)
| sets the logger to be used
logger | get_logger (void)
| returns the logger currently in use
boost::asio::ip::tcp::acceptor & | get_acceptor (void)
| returns mutable reference to the TCP connection acceptor
const boost::asio::ip::tcp::acceptor & | get_acceptor (void) const
| returns const reference to the TCP connection acceptor

## Additional Inherited Members

Protected Member Functions inherited from pion::tcp::server
| server (const unsigned int tcp_port)
| server (const boost::asio::ip::tcp::endpoint &endpoint)
| server (scheduler &sched, const unsigned int tcp_port=0)
| server (scheduler &sched, const boost::asio::ip::tcp::endpoint &endpoint)
virtual void | before_starting (void)
| called before the TCP server starts listening for new connections
virtual void | after_stopping (void)
| called after the TCP server has stopped listing for new connections
boost::asio::io_service & | get_io_service (void)
| returns an async I/O service used to schedule work
Protected Attributes inherited from pion::tcp::server
logger | m_logger
| primary logging interface used by this class

## Detailed Description

simple TCP server that just sends "Hello there!" to each connection

Definition at line 22 of file helloserver.cpp.

## Member Function Documentation

## handle_connection()

virtual void HelloServer::handle_connection | ( | const tcp::connection_ptr & | tcp_conn | ) |

inline virtual

handles a new TCP connection; derived classes SHOULD override this since the default behavior does nothing

Parameters

  tcp_conn | the new TCP connection to handle

Reimplemented from pion::tcp::server.

Definition at line 26 of file helloserver.cpp.

References pion::tcp::connection::finish().

The documentation for this class was generated from the following file:

- utils/helloserver.cpp