LIBWIRE
Next-generation C++17 networking library.
|
Restricted wrapper for TCP listening socket. More...
#include <listener.hpp>
Public Member Functions | |
listener () noexcept=default | |
Construct listener object. More... | |
listener (const listener &)=delete | |
listener (listener &&) noexcept=default | |
listener (endpoint target, std::error_code &ec, unsigned backlog=internal_::socket::max_pending_connections) noexcept | |
Construct listener and start accepting connections. More... | |
listener (endpoint target, unsigned backlog=internal_::socket::max_pending_connections) | |
~listener ()=default | |
socket | accept (std::error_code &ec) noexcept |
Accept first connection from listener queue and create socket for it. More... | |
void | listen (endpoint target, std::error_code &ec, unsigned max_backlog=internal_::socket::max_pending_connections) noexcept |
Start listening for incoming connections on specified endpoint. More... | |
listener & | operator= (const listener &)=delete |
listener & | operator= (listener &&) noexcept=default |
Restricted wrapper for TCP listening socket.
"Restricted" because it exposes only API required for server. You can start listening on port using listen() method and accept connection from queue using accept() method.
Quick usage example:
Definition at line 51 of file listener.hpp.
|
defaultnoexcept |
Construct listener object.
|
delete |
|
defaultnoexcept |
|
default |
|
inlinenoexcept |
Construct listener and start accepting connections.
See listen documentation for arguments description.
Definition at line 72 of file listener.hpp.
|
inline |
Definition at line 77 of file listener.hpp.
|
noexcept |
Accept first connection from listener queue and create socket for it.
Any errors occurred (open sockets limit hit, for example) will be reported through ec argument.
|
noexcept |
Start listening for incoming connections on specified endpoint.
backlog argument sets maximum size of pending connections queue.
Any errors occurred (invalid address or already used port, for example) will be reported through ec argument.
This function combines bind() and listen() of underlying socket API.