Ask Your Question
0

[ROS2] Finding the originating socket for a ROS2 node

asked 2019-06-14 04:24:24 -0500

wan_da gravatar image

I have created my own little node called tester_publisht, and am trying to find the originating socket of the node. However, the node is using 4 separate ports, and I have no idea what the output means.

user@ubuntu:~$ lsof -iUDP
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
spotify    2067 user   92u  IPv4 276438      0t0  UDP *:57621 
spotify    2067 user  108u  IPv4 276451      0t0  UDP *:1900 
spotify    2067 user  128u  IPv4 276452      0t0  UDP *:55193 
tester_pu  9642 user    6u  IPv4 241204      0t0  UDP *:7400 
tester_pu  9642 user    7u  IPv4 241207      0t0  UDP *:7412 
tester_pu  9642 user    8u  IPv4 241210      0t0  UDP *:7413 
tester_pu  9642 user    9u  IPv4 241213      0t0  UDP *:41004 
rqt_graph 14766 user   24u  IPv4 243242      0t0  UDP *:7400 
rqt_graph 14766 user   25u  IPv4 243246      0t0  UDP *:7414 
rqt_graph 14766 user   26u  IPv4 243250      0t0  UDP *:7415 
rqt_graph 14766 user   27u  IPv4 243253      0t0  UDP *:39130 
_ros2_dae 19978 user    6u  IPv4 250922      0t0  UDP *:7400 
_ros2_dae 19978 user    7u  IPv4 250927      0t0  UDP *:7416 
_ros2_dae 19978 user    8u  IPv4 250932      0t0  UDP *:7417 
_ros2_dae 19978 user    9u  IPv4 250935      0t0  UDP *:36155

tester_publisht, rqt_graph and _ros2_daemon are the nodes that are running (sorry about Spotify :) ).

Running ros2 node list -a reveals the three nodes above, and running ros2 topic list returns /clock (the topic that tester_publisht is publishing to), /parameter_events and /rosout.

I tried to listen in on the ports for tester_publisht, but was only able to listen onto port 7400. The rest (7412, 7413, and 41004) could not be listened to:

user@ubuntu:~$ nc -lvu 7400
Listening on [0.0.0.0] (family 0, port 7400)
Connection from ubuntu 39130 received!
RTPS
®9     �f]�̓K���P
®9�3���2��
�1��
��X?
     brqt_gui_py_node_14766,,(name=rqt_gui_py_node_14766;namespace=/;^C
user@ubuntu:~$ nc -lvu 7412
nc: Address already in use
user@ubuntu:~$ nc -lvu 7413
nc: Address already in use
user@ubuntu:~$ nc -lvu 41004
nc: Address already in use

However, port 7400 is also shared with the other two nodes rqt_graph and _ros2_daemon, as shown in the first code block.

So I don't really understand what is the significance of port 7400. And also, which is the originating socket for tester_publisht, or for each of the nodes for that matter?

edit retag flag offensive close merge delete

Comments

1

ROS 2 uses DDS by default as the underlying middleware. You're question could be rephrased as: "how does DDS use these ports that my nodes are opening?".

This is not an answer, but for your understanding it might help to find some documentation on DDS and how it makes use of UDP and TCP ports in various situations.

gvdhoorn gravatar imagegvdhoorn ( 2019-06-14 04:32:48 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2019-06-14 04:35:09 -0500

gvdhoorn gravatar image

updated 2019-06-14 04:39:02 -0500

I believe this is partly answered by #q295400.

Especially the RTI documentation linked in that answer provides quite some detail: What network port numbers does RTI Connext use? .

And from Statically configure a Firewall to let OMG DDS Traffic through:

By default, each DomainParticipant opens 4 UDP/IP ports: Two of those ports are multicast ports which are shared among all domain participants in the same DomainId. The other two are unicast ports which are different for each participant within a computer.

edit flag offensive delete link more

Comments

Okay, I now understand what is 7400, 7412 and 7413. However, I still don't understand what is 41004, or any of the larger port numbers.

wan_da gravatar imagewan_da ( 2019-06-16 22:26:37 -0500 )edit

Oh wait, never mind. According to https://community.rti.com/forum-topic... the bigger port numbers are ephemeral ports.

wan_da gravatar imagewan_da ( 2019-06-17 00:55:12 -0500 )edit
1

Many of the DDS ports are calculated via a deterministic algorithm. The DDS specification describes what ports are used by the RTPS protocol and the discovery protocol, and how they are chosen. https://www.omg.org/spec/DDS/About-DDS/

Geoff gravatar imageGeoff ( 2019-06-17 01:35:43 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-06-14 04:24:24 -0500

Seen: 30 times

Last updated: Jun 14