From 87684320ac0874ea52c9857c0189af559bda0f12 Mon Sep 17 00:00:00 2001 From: Benny Baumann <BenBE@geshi.org> Date: Sun, 19 Feb 2023 23:05:07 +0100 Subject: [PATCH] add: Allow binding to an interface --- src/net/tcp_server_socket.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/net/tcp_server_socket.hpp b/src/net/tcp_server_socket.hpp index c24c5de..aa38fb3 100644 --- a/src/net/tcp_server_socket.hpp +++ b/src/net/tcp_server_socket.hpp @@ -56,6 +56,16 @@ public: */ tcp_server_socket(const socketaddr& socket_identifier, incoming_client_listener_type client_listener_); + /** + * This constructor accepts an interface address and a port to bind to and the client listener that should be called when clients arrive. + * This constructor tries to guess the correct address family and interface. + * @brief Construct a TCP server that listens the specified interface + * @param interface_description The interface to bind to + * @param port The port to bind to + * @param client_listener_ The client listener to call when a client arrives. + */ + tcp_server_socket(const std::string& interface_description, const uint16_t port, incoming_client_listener_type client_listener_); + /** * This method provides you with the current number of connected clients. When a client * disconnects this number will be reduced. When a new client arrives this number will be incremented. -- GitLab