经过同事Zero和DDS技术大牛Stone的指导、演示本人终于会两台机器上DDS通信。

OpenDDS不同机器上通信有两种方式:

    一. 通过repo.ior通信(这种方式是opendds成熟的且自有的);

    二. 通过IP:PORT通信(通过RTPS在不同DDS之间相互发现)。

 

一、 通过repo.ior通信

    运行程序DCPSInfoRepo,subscriber,publisher;

    先在A机器上运行DCPSInfoRepo和subscriber;然后在B机器上运行publisher。

    (1)A机器上先运行&DDS_ROOT/bin/DCPSInfoRepo-ORBDebugLevel 10 -ORBLogFile

              DCPSInfoRepo.log -o repo.ior;

    (2)拷贝A机器上repo.ior文件到B机器上;

    (3)A机器上运行./subscriber  -ORBDebugLevel 10 -DCPSDebugLevel 10 –

              DCPSTransportDebugLevel 6 -ORBLogFile subscriber.log

    (4)B机器上运行./publisher  -ORBDebugLevel 10 -DCPSDebugLevel 10 –

              ORBLogFile publisher.log

    注意事项:

   (1)   DCPSInfoRepo生成的repo.ior文件必须存放在subscriber和publisher工程文件目录下;

   (2)   必须先运行DCPSInfoRepo,然后拷贝repo.ior文件到其他机器上;

   (3)   如果是使用Linux虚拟机切记不要使用NAT模式,使用桥接模式(本人之前就是适应NAT模式导致运行失败)。

 

二、 通过IP和PORT通信

    运行程序DCPSInfoRepo,subscriber,publisher;

    先在A机器上运行DCPSInfoRepo和subscriber;然后在B机器上运行publisher。

 

    (1) 在A机器上运行DCPSInfoRepo程序,&DDS_ROOT/bin/DCPSInfoRepo -ORBListenEndpoints iiop://192.168.2.55:12345-ORBDebugLevel 10

         注:这个IP地址为当前DCPSInfoRepo运行的机器的IP地址,端口号可以随意配置,只要没有被占用就行。

    (2)首先修改subscriber和publisher的配置文件,比如dds_tcp_conf.ini

        原来配置文件如图 1.1所示:

                                                                                       OpenDDS在两台机器上使用方式

图 1.1 dds_tcp_conf.ini原文件

       修改后如图 1.2所示:

      把原来“localhost:12345”修改为“192.168.2.55:12345”(注这个IP地址为DCPSInfoRepo运行的机器IP地址和端口),subscriber和publisher配置文件修改一样。

                                                                                OpenDDS在两台机器上使用方式

                                                                                                                              图 1.2 修改后dds_tcp_conf.ini

   (3)A机器运行subscriber,./subscriber -DCPSConfigFiledds_tcp_conf.ini

   (4)B机器运行publisher,./publisher -DCPSConfigFiledds_tcp_conf.ini

 

     以上就是OpenDDS在两台机器通信方式,本人测试过。

相关文章:

  • 2021-04-08
  • 2022-12-23
  • 2021-11-12
  • 2021-10-31
  • 2021-04-28
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-21
  • 2021-08-10
  • 2022-03-01
  • 2022-12-23
相关资源
相似解决方案