#include <TCPServerListener.h>
Public Member Functions | |
TCPServerListener (TCPServer *server, uint16_t port) | |
void | threadFunction () override |
void | terminate () override |
void | listen () |
uint16_t | port () const |
String | error () const |
void | stop () |
Public Member Functions inherited from sptk::Thread | |
Thread (const String &name, const std::shared_ptr< ThreadManager > &threadManager=nullptr) | |
virtual | ~Thread () |
virtual void | run () |
bool | running () const |
virtual void | threadFunction ()=0 |
virtual void | terminate () |
virtual void | onThreadExit () |
virtual bool | terminated () |
virtual void | join () |
Id | id () const |
const String & | name () const |
virtual bool | sleep_for (std::chrono::milliseconds interval) |
virtual bool | sleep_until (const DateTime ×tamp) |
Additional Inherited Members | |
Public Types inherited from sptk::Thread | |
using | Id = std::thread::id |
Internal TCP server listener thread
sptk::TCPServerListener::TCPServerListener | ( | TCPServer * | server, |
uint16_t | port | ||
) |
Constructor
server | CTCPServer*, TCP server created connection |
port | int, Listener port number |
|
inline |
Returns latest socket error (if any)
|
inline |
Start socket listening
References sptk::BaseSocket::listen(), sptk::Thread::run(), and sptk::Thread::running().
|
inline |
Returns listener port number
References sptk::BaseSocket::host().
void sptk::TCPServerListener::stop | ( | ) |
Stop running listener and join its thread
|
overridevirtual |
Custom thread terminate method
Reimplemented from sptk::Thread.
|
overridevirtual |
Thread function
Implements sptk::Thread.