The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research
mhaserver_t::tcp_server_t Class Reference
Inheritance diagram for mhaserver_t::tcp_server_t:
Inheritance graph

Public Member Functions

 tcp_server_t (const std::string &interface, uint16_t port, mhaserver_t *mha)
 
virtual bool on_received_line (std::shared_ptr< mha_tcp::buffered_socket_t > c, const std::string &l) override
 This method is invoked when a line of text is received on one of the accepted connections. More...
 
- Public Member Functions inherited from mha_tcp::server_t
 server_t (const std::string &interface, uint16_t port)
 Allocates a TCP server. More...
 
uint16_t get_port () const
 
asio::ip::tcp::endpoint get_endpoint () const
 
asio::ip::address get_address () const
 
size_t get_num_accepted_connections () const
 
void run ()
 Accepts connections on the TCP port and serves them. More...
 
virtual void shutdown ()
 Shuts down the server: Close the acceptor (no new connections), shuts down the receiving direction of all accepted connections (no new commands, but responses can still be finished), registers a timer event that will cause event loop termination and return from the run() method 1 second in the future, giving us reasonably enough time for the pending responses to be sent out. More...
 
virtual ~server_t ()=default
 Make destructor virtual. More...
 
asio::io_context & get_context ()
 

Private Attributes

mhaserver_tmha
 

Constructor & Destructor Documentation

◆ tcp_server_t()

mhaserver_t::tcp_server_t::tcp_server_t ( const std::string &  interface,
uint16_t  port,
mhaserver_t mha 
)
inline

Member Function Documentation

◆ on_received_line()

virtual bool mhaserver_t::tcp_server_t::on_received_line ( std::shared_ptr< mha_tcp::buffered_socket_t c,
const std::string &  l 
)
inlineoverridevirtual

This method is invoked when a line of text is received on one of the accepted connections.

Override this method to process the communication with the client.

Parameters
cthe connection that has received this line
lthe line that has been received, without the line ending
Returns
client should return true when client wants to read another line of text, else false.

Reimplemented from mha_tcp::server_t.

Member Data Documentation

◆ mha

mhaserver_t* mhaserver_t::tcp_server_t::mha
private

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