1

I'm trying to understand DDS and learn it. I've been reading tutorials here and there about OpenSplice DDS, and there's something there puzzling me.

In this tutorial, the tutor mentions that there's some kind of "Magic" in page 8 that the publisher and subscriber are decoupled where participants are automatically detected.

But what if I have a participant in another computer? Or maybe in another country?

Taking a look at this example of a publisher:

dds::Topic<TempSensorType> tsTopic("TempSensorTopic");
dds::DataWriter<TempSensorType> dw(tsTopic);
TempSensorTypets = {1, 26.0F, 70.0F, CELSIUS};
dw.write(ts);

and this example of a subscriber:

dds::Topic<TempSensorType> tsTopic("TempSensorTopic");
dds::DataReader<TempSensorType> dr(tsTopic);
dds::SampleInfoSeq info;TempSensorSeq data;
while (true) 
{   dr.read(data, info);
    for (inti =0; i < data.length(); ++i)
        std::cout << data[i] << std::endl;sleep(1);
}

and this full working example of both (tspub.cpp is publisher, and tssub.cpp is subscriber), I don't understand how people could connect remotely. How can I subscribe to another machine? How can I get this nice and simple example to work remotely?

Please ask if you require more information or details.

4

1 回答 1

1

Participants connect to each other via UDP multicast -- keep in mind this is described in the standard, so for a full and complete understanding, go read that. It's freely available.

Only UDP is defined in the specification, so if they use an alternative connection strategy (shmem, TCP, other), then it will be vendor dependent. RTI implementations don't talk to OpenSplice implementations over shmem (but they can via UDP loopback).

There is a negotiation that starts with known UDP ports.

If two systems are on the same subnet, and have multicast enabled, they will connect via the magic described in the standard. This assumes they have compatible Domain IDs, Topics, Types and QoS.

Really: Read the standard.

于 2017-01-31T15:23:20.770 回答