ADLINK-IST / opensplice

This is the Vortex OpenSplice Community Edition source repository. For our commercial offering see
https://www.adlinktech.com/en/vortex-opensplice-data-distribution-service
Apache License 2.0
259 stars 155 forks source link

TCP/IP connection #81

Open joscorzaf opened 5 years ago

joscorzaf commented 5 years ago

my question is if opensplice supports TCP/IP connections? Note that I have installed it and have run the examples properly. I have tried to use the HelloWorld example in TCP mode without success, beacuse of the multicast is not enabled in the network. Basically, I have tried to add the elements "TCP" and "Peer" to the ospl.xml file.

Do you have any suggestion on this? Thanks in advance!

hansvanthag commented 5 years ago

Yes it is supported, in which case you DO have to provide the endpoints explicitly though, like in this example configuration (which is somewhat 'special' in the sense that it shows how to exploit TCP between processes that are on the same machine and therefore require different port-numbers i.e. each application will have its 'private' URI-config that identifies 'itself' by its portnr. in the TCP section):

<DDSI2Service name="ddsi2">
    <General>
        <NetworkInterfaceAddress>AUTO</NetworkInterfaceAddress>
        <AllowMulticast>false</AllowMulticast>
        <EnableMulticastLoopback>true</EnableMulticastLoopback>
        <CoexistWithNativeNetworking>false</CoexistWithNativeNetworking>
    </General>
    <Compatibility>
        <!-- see the release notes and/or the OpenSplice configurator on DDSI interoperability -->
        <StandardsConformance>lax</StandardsConformance>
        <!-- the following one is necessary only for TwinOaks CoreDX DDS compatibility -->
        <!-- <ExplicitlyPublishQosSetToDefault>true</ExplicitlyPublishQosSetToDefault> -->
    </Compatibility>
    <TCP>
        <Enable>true</Enable>
    <Port>6001</Port>
    </TCP>
    <Discovery>
        <Peers>
            <Peer Address="10.5.150.254:6001"/>
    <Peer Address="10.5.150.254:6002"/>
    <Peer Address="10.5.150.254:6003"/>
        </Peers>
    </Discovery>
</DDSI2Service>

If there's just 1 application per machine, they could all use the same portnr but then each would have their specific IP-address (all listed under the 'Peers' section).

joscorzaf commented 5 years ago

Thanks so much, it is working. Checking your configuration file I realized that I was adding the peers in a wrong format.

Now I have another issue. After success testing on my LAN network, I am trying to communicate two machines where one is located on my LAN network and the other one is out with connectivity by LTE modem (so it has no accessible IP, I mean no public IP). Do you think it is possible that it works?

Thanks in advance for your help!

hansvanthag commented 5 years ago

Unlike what my example-configuration perhaps suggests, its not needed to to have different TCP connections for ingoing as well as outgoing traffic, so your 'LTE-connected-machine-without-a-public-IP 'just' has to connect to your LAN-machine-that-DOES-have-a-public-IP and 'off you go' .. at least in theory :)

Its like a 'dial-in' pattern (so where your LAN-machine doesn't need to be setup/configured to 'dial-out')

joscorzaf commented 5 years ago

thanks for your help! I was trying it but unsuccessfully. Sniffing the traffic between the two machines, I realized that at one point of the messages flow the "machine-with-public-IP" tries to reach the "LTE-machine".... and stopping the message flow at that moment due to that this machine (LTE-machine) cannot be reached from outside as might be expected :(

hansvanthag commented 5 years ago

Thats indeed strange, when configuring 'one-way' (i.e. the machine-with-public-IP is configured as a peer but not the other way around), there shouldn't be any attempt to open a port on the LTE-machine ..

hansvanthag commented 5 years ago

.. and furthermore (sorry for forgetting about this), the LTE-machine should NOT configure the TCP-port as otherwise its sort of 'solliciting' others to try connecting to it .. so this section should NOT be there for the LTE-machine:

<TCP>
    <Enable>true</Enable>
<Port>6001</Port>
</TCP>
joscorzaf commented 5 years ago

First off, my apologies for the delay on the response but I had to leave temporarily this issue. I have taken up the task again and have tested what you commented on previous posts but without any success. I have not managed to make it work over LTE (I can only manage to get it to run when the machines are located in the same subnet). Over LTE, the configuration files for both machines are as follows:

LTE-Machine (Publisher) `

wlx00195b2c4db4falsetruefalse
  <Compatibility>
       <StandardsConformance>lax</StandardsConformance>
  </Compatibility>
  <TCP>
       <Enable>true</Enable>
  </TCP>
  <Discovery>
       <Peers>
            <Peer Address="public_ip:6001"/>
       </Peers>
  </Discovery>

`

Local-Machine (Subscriber) `

ens33 false true false
    <Compatibility>
        <StandardsConformance>lax</StandardsConformance>
    </Compatibility>
    <TCP>
            <Enable>true</Enable>
            <Port>6001</Port>
    </TCP>
</DDSI2Service>`

As I mentioned previously, when I connect the "LTE-machine" to the subnet and change the public IP to the local IP it does work. Can you see anything missing or wrong? Is it necessary to enable something in the config file to allow external connections from outside? With tcpdump I have checked that the requests from "LTE-machine" are reaching the local machine in order to validate the NAT action in the router.

Thanks in advance for your support! Please let me know if you need more information.

hansvanthag commented 5 years ago

Perhaps this option is what you're looking for:

image