How to understand the number of ports used in a DDS Context application?

9 posts / 0 new
Last post
Offline
Last seen: 5 years 2 months ago
Joined: 04/16/2015
Posts: 11
How to understand the number of ports used in a DDS Context application?

I am new to DDS Context and I am quite confused about the network port used in a Context application. I have read the user guide and I understand how the Context compute the port number. But when I start the runPub.sh in Hello_simple example under ndds5.0.0/samples/JAVA directory, I found this helloworld application takes 6 network ports on the system. Please see below output. I wander why it takes so many ports number. Does each subscriber/publisher in one domain take a single port number?

udp 0 0 0.0.0.0:54461 0.0.0.0:* 16290/java
udp 0 0 0.0.0.0:7400 0.0.0.0:* 16290/java
udp 0 0 0.0.0.0:59882 0.0.0.0:* 16290/java
udp 0 0 0.0.0.0:7410 0.0.0.0:* 16290/java
udp 0 0 0.0.0.0:7411 0.0.0.0:* 16290/java
udp 0 0 0.0.0.0:59668 0.0.0.0:* 16290/java

gianpiero's picture
Offline
Last seen: 1 year 3 months ago
Joined: 06/02/2010
Posts: 174

Hi there,

Maybe this article can, help you out: https://community.rti.com/kb/what-network-port-numbers-does-rti-connext-use

Best,
  Gianpiero

Offline
Last seen: 5 years 2 months ago
Joined: 04/16/2015
Posts: 11

I have read this article before but it doesn't explain why a domain takes 6 port number. I have tried that no matter how manu data reader/writers created under one domain, it always take 6 network UDP ports. 

Offline
Last seen: 5 years 2 months ago
Joined: 04/16/2015
Posts: 11

Are both of the multicast and unicast port number used by an RTI application? If a writer writes a data to a reader, how do I know whether it uses multicast or unicast port?

rip
rip's picture
Offline
Last seen: 20 hours 36 min ago
Joined: 04/06/2012
Posts: 321

Are both used:  yes (by default, and it is configurable).  See the Discovery chapter (chapter 14) of the documentation.

How a writer sends to a remote reader endpoint depends on the transports that are configured.  The default setting will use unicast for use data and multicast (announcments) and unicast (followup, again, see chapter 14) for discovery.

Offline
Last seen: 5 years 2 months ago
Joined: 04/16/2015
Posts: 11

The default setting will use two ports, one is unicast, the other is multicast, is it right? The chapter 14 mentions 4 ports, metatraffic.multicast.port, metatraffic.unicast.port, usertraffic.multicast.port and usertraffic.unicast.port. Will the default setting use 2 of them? 

rip
rip's picture
Offline
Last seen: 20 hours 36 min ago
Joined: 04/06/2012
Posts: 321

If you are using the defaults, then it will use all of them.

 

Offline
Last seen: 5 years 2 months ago
Joined: 04/16/2015
Posts: 11

Why does it use 4 ports? I assume one multicast port is for discovery the other is for user traffic. What are the other two used for?

fercs77's picture
Offline
Last seen: 9 months 3 weeks ago
Joined: 01/15/2011
Posts: 29

Hi,

I am copying the ports from your original message for convenience:

udp 0 0 0.0.0.0:54461 0.0.0.0:* 16290/java
udp 0 0 0.0.0.0:7400 0.0.0.0:* 16290/java
udp 0 0 0.0.0.0:59882 0.0.0.0:* 16290/java
udp 0 0 0.0.0.0:7410 0.0.0.0:* 16290/java
udp 0 0 0.0.0.0:7411 0.0.0.0:* 16290/java
udp 0 0 0.0.0.0:59668 0.0.0.0:* 16290/java

The ports 7400, 7410, and 7411 are used to receive data. We create one socket per port.

7400 —> It is used to receive discovery data over multicast

7410 —> It is used to receive discovery data over unicast

7411 —> It is used to receive user data over unicast 

Why are we using different ports? Because we want to be able to receive and process concurrently these three types of traffic. There is one thread associated with each port.

The previous receive ports are per DomainParticipant. By default, we do not use separate ports per DataWriters and DataReaders. 

The ports 54461, 59992, and 59668 are ephemeral ports used to send data. By default, we will create one socket to send unicast data. This socket will be bound to one of the previous ports. In addition, we will also create one socket per multicast capable interface to send multicast data. In this case, and based on the information that you provide I am assuming you have two interfaces.

Why do we create one socket per interface to send multicast data? We do that because we want to guarantee that multicast traffic is sent in each one of the available interfaces that are multicast capable. In order to do that we use the socket option IP_MULTICAST_IF to bind each socket to a separate interface.

Regards,

Fernando