Ask Your Question
0

[ROS Communication] Multiple sockets and ports

asked 2019-07-17 02:27:49 -0600

Ariel gravatar image

updated 2019-07-23 13:26:06 -0600

jayess gravatar image

Hello,

I would like to confirm this:

  1. Suppose that there is one publisher. Therefore, it opens a socket. There, any subscriber can connect to the same socket but on different ports, right?
  2. Let's say there is now a second publisher. So, it will open a new socket and any subscriber can connect to it, also if there are multiple, over different ports.

Is that correct? Thank you very much.


Update:

Just to confirm if I understood correctly. Let's say I have a publisher, a subscriber and ros master all running on 3 different computers. From the publisher perspective, it will need one socket to communicate with the master via xmlrpc, and two sockets per subscriber, one for the negotiation part with xmlrpc (to receive requestTopic) and a third one to actually send data to the subscriber. Is that correct?

If it is, then the publisher will need two extra sockets if a second subscriber comes, right?

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-07-17 02:38:38 -0600

gvdhoorn gravatar image

updated 2019-07-17 02:43:05 -0600

Suppose that there is one publisher. Therefore, it opens a socket. There, any subscriber can connect to the same socket but on different ports, right?

Not entirely: the server socket will always be listening on the same port, but clients will use a random (ie: ephemeral) port to connect to it.

Let's say there is now a second publisher. So, it will open a new socket and any subscriber can connect to it, also if there are multiple, over different ports.

A new publisher will use a different socket, and thus port, yes.

At least, that is how it works with TCP and UDP, which is essentially what TCPROS and UDPROS use.

edit flag offensive delete link more

Comments

To make this a bit more of a meaningful Q&A: what made you ask these questions? They seem not very specific to ROS, but more about basic networking and socket programming.

gvdhoorn gravatar imagegvdhoorn ( 2019-07-17 02:39:03 -0600 )edit

I want to implement a ros node on a platform where I cannot run ROS. Therefore the question. Thanks for clearing my questions

Ariel gravatar imageAriel ( 2019-07-17 02:54:22 -0600 )edit

I want to implement a ros node on a platform where I cannot run ROS

what does that mean exactly?

Have you looked at any of the alternative client libraries? rosbridge?

Might be easier to realise than implementing TCPROS from scratch.

gvdhoorn gravatar imagegvdhoorn ( 2019-07-17 02:55:46 -0600 )edit

I have limited resources. So, the plan is to use xmlrpc to communicate with ros master and then when use tcpros. Based on the documentation, I need to build the header and stream the corresponding data over a tcp/ip standard communication, or not?

Ariel gravatar imageAriel ( 2019-07-17 03:08:12 -0600 )edit

If "limited resources" means: limited memory, limited cpu or limited runtime, perhaps a pure ansi c implementation suitable for running on PLCs might be a way forward? Something like cros?

gvdhoorn gravatar imagegvdhoorn ( 2019-07-17 03:34:42 -0600 )edit

I did not know about cros. I will check it out. The main concern is how to build the frame to send from a publisher to a subscriber (tcpros). The xml-rpc part should be no problem as it is a simple design, just registering nodes and only using topics. For now, there is no need for services.

Ariel gravatar imageAriel ( 2019-07-17 03:38:55 -0600 )edit

I did not know about cros

I would advise you to at least take a look at it.

gvdhoorn gravatar imagegvdhoorn ( 2019-07-17 03:54:56 -0600 )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-07-17 02:27:49 -0600

Seen: 86 times

Last updated: Jul 23