Network configuration
Set the environment variable CYCLONEDDS_URI=file:///path/to/cyclone.xml pointing to a file with the following content. Choose between localhost configuration and system configuration.
Localhost
For local development on your pc you should make sure to set the communication to localhost to not interfere with other people in the network or the firewall.
<?xml version="1.0" encoding="UTF-8" ?>
<CycloneDDS xmlns="https://cdds.io/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://cdds.io/config https://raw.githubusercontent.com/eclipse-cyclonedds/cyclonedds/master/etc/cyclonedds.xsd">
<Domain Id="any">
<General>
<Interfaces>
<NetworkInterface address="127.0.0.1" prefer_multicast="false"></NetworkInterface>
</Interfaces>
</General>
<Discovery>
<ParticipantIndex>auto</ParticipantIndex>
</Discovery>
</Domain>
</CycloneDDS>
Config for wired-connections
For a real local system the network adapter needs to be configured from which the communication shall be done.
<?xml version="1.0" encoding="UTF-8" ?>
<CycloneDDS xmlns="https://cdds.io/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://cdds.io/config https://raw.githubusercontent.com/eclipse-cyclonedds/cyclonedds/master/etc/cyclonedds.xsd">
<Domain Id="any">
<General>
<Interfaces>
<NetworkInterface address="192.168.1.42"></NetworkInterface>
</Interfaces>
</General>
<Discovery>
<ParticipantIndex>auto</ParticipantIndex>
</Discovery>
</Domain>
</CycloneDDS>
Config for wireless-connections
For wireless networks additional configuration is required.
Multicast is generally hopeless on WiFi because it doesn't do any retransmits in hardware, unlike unicast. It could also be that for example radios map a multicast to a repeated unicast. But then you'd be much better of using unicast for everything (except SPDP): because with unicast you never send the data to machines that don't need it but the radio's wouldn't know which ones to skip.
- Use multicast only for participant discovery (spdp), so we dont need to track all ip addresses in every cyclone.xml.
- No multicast for data and endpoint discovery (sedp).
Configuration:
<?xml version="1.0" encoding="UTF-8" ?>
<CycloneDDS xmlns="https://cdds.io/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://cdds.io/config https://raw.githubusercontent.com/eclipse-cyclonedds/cyclonedds/master/etc/cyclonedds.xsd">
<Domain Id="any">
<General>
<AllowMulticast>spdp</AllowMulticast>
<Interfaces>
<NetworkInterface address="192.168.1.42"></NetworkInterface>
</Interfaces>
</General>
<Discovery>
<ParticipantIndex>auto</ParticipantIndex>
</Discovery>
</Domain>
</CycloneDDS>
Config for Unicast only (No Multicast)
This configuration disables all usage of multicast.
Only use this configuration if multicast is not possible or not allowed. For example in cloud environments, public internet or firewalls that block multicast.
<?xml version="1.0" encoding="UTF-8" ?>
<CycloneDDS xmlns="https://cdds.io/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://cdds.io/config https://raw.githubusercontent.com/eclipse-cyclonedds/cyclonedds/master/etc/cyclonedds.xsd">
<Domain Id="any">
<General>
<AllowMulticast>false</AllowMulticast>
<Interfaces>
<NetworkInterface address="192.168.1.42" allow_multicast="false"></NetworkInterface>
</Interfaces>
</General>
<Discovery>
<Peers>
<Peer address="xxx.xxx.xxx.xxx" PruneDelay="inf"/>
<Peer address="xxx.xxx.xxx.xxx" PruneDelay="inf"/>
</Peers>
</Discovery>
</Domain>
</CycloneDDS>
Logging
In order to change the log level of this library, a .json file can be placed in the same directory as the executable. Both files need to have the same name. For example: app.json and app.exe The logging supports multiple sinks, each of it requires a type of either cerr, cout or file. If the type is set to file an additional key file has to be set to define the output log file.
Alternatively the logfile can be set via the env variable DDKIT_CFG=/path/to/ddkit_cfg.json.
{
"ddkit": {
"log": {
"sinks" : [
{
"type": "cerr", // cerr, cout, file
//"file": "ddkit.log",
"level": "warn" // trace, debug, info, warn, error, fatal, off
}
]
}
}
}