Listen for incoming TCP connections on a socket.
More...
#include <uringpp/tcp_listener.h>
|
static tcp_listener | listen (std::shared_ptr< event_loop > loop, std::string const &hostname, std::string const &port, int backlog=128) |
| Listen for incoming TCP connections on the given address. It will create a socket and bind it to the given address. More...
|
|
Listen for incoming TCP connections on a socket.
◆ tcp_listener()
uringpp::tcp_listener::tcp_listener |
( |
tcp_listener && |
other | ) |
|
|
inlinenoexcept |
Move construct a new listener object.
- Parameters
-
◆ ~tcp_listener()
uringpp::tcp_listener::~tcp_listener |
( |
| ) |
|
|
inline |
Destroy the listener object. If the socket is still open, it will be closed.
◆ accept() [1/2]
Accept an incoming connection.
- Returns
- task<std::pair<ip_address, socket>> A pair of the remote address and the accepted socket
◆ accept() [2/2]
Accept an incoming connection and attach it with the specified loop.
- Returns
- task<std::pair<ip_address, socket>> A pair of the remote address and the accepted socket
◆ close()
task< void > uringpp::tcp_listener::close |
( |
| ) |
|
|
inline |
Close the listener.
- Returns
- task<void>
◆ fd()
int uringpp::tcp_listener::fd |
( |
| ) |
const |
|
inline |
Get the file descriptor of the listener.
- Returns
- int The file descriptor of the listener.
◆ listen()
static tcp_listener uringpp::tcp_listener::listen |
( |
std::shared_ptr< event_loop > |
loop, |
|
|
std::string const & |
hostname, |
|
|
std::string const & |
port, |
|
|
int |
backlog = 128 |
|
) |
| |
|
inlinestatic |
Listen for incoming TCP connections on the given address. It will create a socket and bind it to the given address.
- Parameters
-
loop | The event loop to use. |
hostname | The hostname to listen on. |
port | The port to listen on. |
- Returns
- listener The listener object
- Examples
- helloworld.cc.
The documentation for this class was generated from the following file: