Skip to content

Commit

Permalink
Add TCP listening port behavior when set to 0 (backport #598) (#606)
Browse files Browse the repository at this point in the history
* Refs #20019: Add TCP listening port behavior when set to 0

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20019: Add info to 6.3.1 section

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Refs #20019: Update port of tcp use case

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

---------

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
(cherry picked from commit 12cb668)

Co-authored-by: Carlos Ferreira González <carlosferreira@eprosima.com>
  • Loading branch information
mergify[bot] and cferreiragonz authored Dec 12, 2023
1 parent 798fa3a commit 15ad1d9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion code/DDSCodeTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5896,7 +5896,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<eprosima::fastdds::rtps::TCPv4TransportDescriptor>();
data_transport->add_listener_port(tcp_listening_port);
pqos.transport().user_transports.push_back(data_transport);
Expand Down
3 changes: 2 additions & 1 deletion code/XMLTester.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3434,7 +3434,7 @@
This needs to be unique for each participant in the host
-->
<listening_ports>
<port>12345</port>
<port>0</port>
</listening_ports>
</transport_descriptor>
</transport_descriptors>
Expand Down Expand Up @@ -3495,6 +3495,7 @@
</dds>
-->
<!--><-->

</profiles>

<!-->CONF-LIBRARY-SETTINGS<-->
Expand Down
2 changes: 1 addition & 1 deletion docs/fastdds/transport/tcp/tcp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ The following table describes the common data members for both TCPv4 and TCPv6.
* - |TCPTransportDescriptor::listening_ports-api|
- ``vector<uint16_t>``
- 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
Expand Down
4 changes: 3 additions & 1 deletion docs/fastdds/xml_configuration/transports.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ A more detailed explanation of each of these elements can be found in :ref:`comm
+-------------------------------+----------------------------------------------------+----------------------+----------+
| ``<listening_ports>`` | Local port to work as TCP acceptor for input |br| | ``List <uint16_t>`` | |
| | 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**). | | |
+-------------------------------+----------------------------------------------------+----------------------+----------+
| ``<tls>`` | Allows to define TLS related parameters and |br| | :ref:`tcp-tls` | |
| | options (**TCP only**). | | |
Expand Down

0 comments on commit 15ad1d9

Please sign in to comment.