#include <tcp.hpp>
|
| connection_listener (uint16_t port) |
| Constructs a connection listener ("server socket") that listens on the given port of this machine's TCP interface. More...
|
|
socket | accept () |
| Blocks until a remote client makes a connection to this connection listener, then returns a new socket connected to that client. More...
|
|
std::optional< socket > | try_accept (int timeout_ms) |
| Waits the specified number of milliseconds for a remote client to connect to this connection listener, then either returns a new socket connected to the client, or nullopt if no client connected before the timeout. More...
|
|
|
std::unique_ptr< int, std::function< void(int *)> > | fd |
|
Definition at line 133 of file tcp.hpp.
◆ connection_listener()
tcp::connection_listener::connection_listener |
( |
uint16_t |
port | ) |
|
|
explicit |
Constructs a connection listener ("server socket") that listens on the given port of this machine's TCP interface.
- Parameters
-
port | The port to listen on. |
Definition at line 210 of file tcp.cpp.
◆ accept()
socket tcp::connection_listener::accept |
( |
| ) |
|
Blocks until a remote client makes a connection to this connection listener, then returns a new socket connected to that client.
- Returns
- A socket connected to a remote client.
Definition at line 236 of file tcp.cpp.
◆ try_accept()
std::optional< socket > tcp::connection_listener::try_accept |
( |
int |
timeout_ms | ) |
|
Waits the specified number of milliseconds for a remote client to connect to this connection listener, then either returns a new socket connected to the client, or nullopt if no client connected before the timeout.
- Parameters
-
timeout_ms | The time to wait for a new connection |
- Returns
- A socket connected to a remote client, or nullopt if the timeout expired
Definition at line 258 of file tcp.cpp.
◆ fd
std::unique_ptr<int, std::function<void(int*)> > tcp::connection_listener::fd |
|
private |
The documentation for this class was generated from the following files: