|
RADLib
RADical C++ application framework
|
Non-blocking TCP server that emits accepted sockets. More...
#include <RADNet.h>
Inheritance diagram for RADNet::RADTcpServer:
Collaboration diagram for RADNet::RADTcpServer:Public Member Functions | |
| RADTcpServer (RADCore::EventLoop &loop) | |
| Creates a server using loop for event delivery. More... | |
| ~RADTcpServer () | |
| Stops listening if needed. More... | |
| bool | listen (uint16_t port, const std::string &address="0.0.0.0", int backlog=128) |
| Starts listening on address:port with backlog. More... | |
| void | close () |
| Stops listening and closes the server descriptor. More... | |
| bool | isListening () const |
| Returns true when the server socket is listening. More... | |
| uint16_t | localPort () const |
| Returns the bound local port, or 0 when unavailable. More... | |
Public Member Functions inherited from RADCore::RADObject | |
| RADObject () | |
| Creates a RADObject bound to the current thread. More... | |
| virtual | ~RADObject () |
| Disconnects tracked event links and releases lifetime token. More... | |
| void | registerLink (const ConnectionRecord &record) |
| Registers a connection for cleanup when this object is destroyed. More... | |
| std::thread::id | threadId () const |
| Returns the thread id this object is currently associated with. More... | |
| EventLoop * | associatedEventLoop () const |
| Returns the associated event loop, if any. More... | |
| ThreadAffinity | threadAffinity () const |
| Returns both thread id and associated loop atomically. More... | |
| std::weak_ptr< void > | lifetimeToken () const |
| Returns a weak token used to drop queued callbacks after destruction. More... | |
| void | moveToThread (std::thread::id tId, EventLoop *loop=nullptr) |
| Moves the object's affinity to tId and optional loop. More... | |
Public Attributes | |
| RADCore::Event< void(std::shared_ptr< RADNet::RADTcpSocket >) > | newConnection |
| Raised when a new client connection is accepted. More... | |
| RADCore::Event< void(std::string) > | errorOccurred |
| Raised when listen, accept, or reactor setup fails. More... | |
Non-blocking TCP server that emits accepted sockets.
|
explicit |
Creates a server using loop for event delivery.
| RADNet::RADTcpServer::~RADTcpServer | ( | ) |
Stops listening if needed.
| void RADNet::RADTcpServer::close | ( | ) |
Stops listening and closes the server descriptor.
| bool RADNet::RADTcpServer::isListening | ( | ) | const |
Returns true when the server socket is listening.
| bool RADNet::RADTcpServer::listen | ( | uint16_t | port, |
| const std::string & | address = "0.0.0.0", |
||
| int | backlog = 128 |
||
| ) |
Starts listening on address:port with backlog.
| uint16_t RADNet::RADTcpServer::localPort | ( | ) | const |
Returns the bound local port, or 0 when unavailable.
| RADCore::Event<void (std::string) > RADNet::RADTcpServer::errorOccurred |
Raised when listen, accept, or reactor setup fails.
| RADCore::Event<void (std::shared_ptr<RADNet::RADTcpSocket>) > RADNet::RADTcpServer::newConnection |
Raised when a new client connection is accepted.