From 8326367bffdcae2964d1f708df36295d1788bb3a Mon Sep 17 00:00:00 2001 From: Pete Date: Sat, 16 May 2026 19:21:32 -0700 Subject: [PATCH] log remote endpoint on each accepted connection --- main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.cpp b/main.cpp index 999b374..bed4a91 100644 --- a/main.cpp +++ b/main.cpp @@ -53,6 +53,13 @@ awaitable listener() { tcp::acceptor acceptor(executor, {tcp::v4(), 79}); for (;;) { tcp::socket socket = co_await acceptor.async_accept(deferred); + boost::system::error_code ec; + auto endpoint = socket.remote_endpoint(ec); + if (!ec) { + std::printf("connection from %s:%u\n", + endpoint.address().to_string().c_str(), + endpoint.port()); + } co_spawn(executor, echo(std::move(socket)), detached); } }