From c9dc185bad638945985bb8a4ad5665a85e70a4f7 Mon Sep 17 00:00:00 2001 From: Florian Reimold <11774314+FlorianReimold@users.noreply.github.com> Date: Fri, 22 Mar 2024 09:18:04 +0100 Subject: [PATCH] Bind publishers to "::" (-> IPv6) by default to support connections from both IPv6 and IPv4. (#24) * Bind publishers to "::" (-> IPv6) by default to support connections from both IPv6 and IPv4. * Updated version number --- tcp_pubsub/include/tcp_pubsub/publisher.h | 12 ++++++++---- tcp_pubsub/src/publisher.cpp | 2 +- tcp_pubsub/version.cmake | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tcp_pubsub/include/tcp_pubsub/publisher.h b/tcp_pubsub/include/tcp_pubsub/publisher.h index 4cba6ca..c2f3d94 100644 --- a/tcp_pubsub/include/tcp_pubsub/publisher.h +++ b/tcp_pubsub/include/tcp_pubsub/publisher.h @@ -63,8 +63,11 @@ namespace tcp_pubsub * used for logging. * * @param[in] address - * The IP address to bind to. When setting this to "0.0.0.0" - * connections from any IP are accepted. + * The IP address to bind to. When setting this to "::", + * connections from any IPv6 & IPv4 are accepted. + * Tip: use an IPv6 IP here to accept both IPv4 and IPv6 + * addresses. If "0.0.0.0" is used, the connections will be + * limited to IPv4 connections. * * @param[in] port * The port to accept connections from. When setting to "0", @@ -87,8 +90,9 @@ namespace tcp_pubsub * port, isRunning() will return false. * * When the port can be opened, the Publisher will immediatelly accept - * connections from Subscribers. Whether the Publisher is running can be - * checked with isRunning(). + * connections from Subscribers. It is bound to "::", meaning that it will + * accept connections from any IPv6 and IPv4 connection. Whether the + * Publisher is running can be checked with isRunning(). * * @param[in] executor * The (global) executor that shall execute the workload and be diff --git a/tcp_pubsub/src/publisher.cpp b/tcp_pubsub/src/publisher.cpp index 1790e47..902e400 100644 --- a/tcp_pubsub/src/publisher.cpp +++ b/tcp_pubsub/src/publisher.cpp @@ -15,7 +15,7 @@ namespace tcp_pubsub } Publisher::Publisher(const std::shared_ptr& executor, uint16_t port) - : Publisher(executor, "0.0.0.0", port) + : Publisher(executor, "::", port) {} Publisher::~Publisher() diff --git a/tcp_pubsub/version.cmake b/tcp_pubsub/version.cmake index 4b0283c..1633fa7 100644 --- a/tcp_pubsub/version.cmake +++ b/tcp_pubsub/version.cmake @@ -1,3 +1,3 @@ set(TCP_PUBSUB_VERSION_MAJOR 1) set(TCP_PUBSUB_VERSION_MINOR 0) -set(TCP_PUBSUB_VERSION_PATCH 4) +set(TCP_PUBSUB_VERSION_PATCH 5)