15.1.3. TCP Communication with Discovery ServerΒΆ

Fast DDS Discovery Server consists on a client-server discovery mechanism, in which a server DomainParticipant operates as the central point of communication. It collects and processes the metatraffic sent by the client DomainParticipants, and then distributes the appropriate information among the rest of the clients. An extended description of the feature can be found at Discovery Server Settings.

To use TCP communication along with Discovery Server, both the server participant and the client participant need to use custom user transports. There exists several ways of configuring the server participant, being Fast DDS CLI the fastest solution:

It can be configured to work over a TCP transport layer by using the arguments -t and -q to set up the IP address and the TCP port, respectively. After sourcing the environment, the following command can be used to instantiate a server listening on localhost and port 12345 (see CLI).

fastdds discovery -i 0 -t 127.0.0.1 -q 12345

The client participant can be configured by either using the ROS_DISCOVERY_SERVER environment variable (see ROS_DISCOVERY_SERVER) or by manually setting it.

To configure a client participant to communicate over the TCP transport layer with the ROS_DISCOVERY_SERVER environment variable, the prefix TCPv4 needs to be used. The following command can be used to configure the variable to set up a client using TCP communication and connecting to a server on localhost and port 12345.

export ROS_DISCOVERY_SERVER=TCPv4:[127.0.0.1]:12345