diff --git a/server_http.hpp b/server_http.hpp index e5f6952..4506313 100644 --- a/server_http.hpp +++ b/server_http.hpp @@ -241,6 +241,16 @@ namespace SimpleWeb { return asio::ip::tcp::endpoint(); } + asio::ip::tcp::endpoint local_endpoint() const noexcept { + try { + if(auto connection = this->connection.lock()) + return connection->socket->lowest_layer().local_endpoint(); + } + catch(...) { + } + return asio::ip::tcp::endpoint(); + } + /// Deprecated, please use remote_endpoint().address().to_string() instead. DEPRECATED std::string remote_endpoint_address() const noexcept { try {