From 12cb66865c5d31de04460cedc29b21a1309267f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ferreira=20Gonz=C3=A1lez?= Date: Mon, 4 Dec 2023 15:37:40 +0100 Subject: [PATCH] Add TCP listening port behavior when set to 0 (#598) * Refs #20019: Add TCP listening port behavior when set to 0 Signed-off-by: cferreiragonz * Refs #20019: Add info to 6.3.1 section Signed-off-by: cferreiragonz * Refs #20019: Update port of tcp use case Signed-off-by: cferreiragonz --------- Signed-off-by: cferreiragonz --- code/DDSCodeTester.cpp | 2 +- code/XMLTester.xml | 2 +- docs/fastdds/transport/tcp/tcp.rst | 2 +- docs/fastdds/xml_configuration/transports.rst | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/code/DDSCodeTester.cpp b/code/DDSCodeTester.cpp index 3555e409e..6f3846e90 100644 --- a/code/DDSCodeTester.cpp +++ b/code/DDSCodeTester.cpp @@ -5997,7 +5997,7 @@ void tcp_use_cases() // TCPv4 transport for EDP and application data (The listening port must to be unique for // each participant in the same host) - constexpr uint16_t tcp_listening_port = 12345; + constexpr uint16_t tcp_listening_port = 0; auto data_transport = std::make_shared(); data_transport->add_listener_port(tcp_listening_port); pqos.transport().user_transports.push_back(data_transport); diff --git a/code/XMLTester.xml b/code/XMLTester.xml index 1ee93c7cb..68356c337 100644 --- a/code/XMLTester.xml +++ b/code/XMLTester.xml @@ -3676,7 +3676,7 @@ This needs to be unique for each participant in the host --> - 12345 + 0 diff --git a/docs/fastdds/transport/tcp/tcp.rst b/docs/fastdds/transport/tcp/tcp.rst index 5eec238ef..97e9b60ad 100644 --- a/docs/fastdds/transport/tcp/tcp.rst +++ b/docs/fastdds/transport/tcp/tcp.rst @@ -71,7 +71,7 @@ The following table describes the common data members for both TCPv4 and TCPv6. * - |TCPTransportDescriptor::listening_ports-api| - ``vector`` - Empty vector - - List of ports to listen as *server*. + - List of ports to listen as *server*. If a port is set to 0, an available port will be automatically assigned. * - |TCPTransportDescriptor::keep_alive_frequency_ms-api| - ``uint32_t`` - 5000 diff --git a/docs/fastdds/xml_configuration/transports.rst b/docs/fastdds/xml_configuration/transports.rst index 8a0ed9982..083e1043a 100644 --- a/docs/fastdds/xml_configuration/transports.rst +++ b/docs/fastdds/xml_configuration/transports.rst @@ -94,7 +94,9 @@ A more detailed explanation of each of these elements can be found in :ref:`comm +-------------------------------+----------------------------------------------------+----------------------+----------+ | ```` | Local port to work as TCP acceptor for input |br| | ``List `` | | | | connections. If not set, the transport will |br| | | | -| | work as TCP client only (**TCP only**). | | | +| | work as TCP client only. If set to 0, an |br| | | | +| | available port will be automatically assigned |br| | | | +| | (**TCP only**). | | | +-------------------------------+----------------------------------------------------+----------------------+----------+ | ```` | Allows to define TLS related parameters and |br| | :ref:`tcp-tls` | | | | options (**TCP only**). | | |