【vsomeip】如何让vsomeip在双系统运行起来----(一)


前言

验证vsomeip可以在Host Linux和LXC 里面的Guest Linux之间进行通信。

  1. 验证vsomeip自带helloworld例程
  2. 创建helloworld的Service和client的配置文件
  3. 验证双机情况下vsomeip通信
  4. 验证LXC 内外系统的vsomeip通信

一、验证vsomeip自带helloworld例程

{
   
    "unicast":"127.0.0.1",
    "logging":
    {
   
        "level":"debug",
        "console":"true"
    },

    "applications":
    [
        {
   
            "name":"hello_world_service",
            "id":"0x4444"
        },

        {
   
            "name":"hello_world_client",
            "id":"0x5555"
        }
    ],

    "services":
    [
        {
   
            "service":"0x1111",
            "instance":"0x2222",
            "unreliable":"30509"
        }
    ],

    "routing":"hello_world_service",
    "service-discovery":
    {
   
        "enable":"false"
    }
}

unicast的地址要更换成127.0.0.1,说明是在本机内部运行。

will@will-OptiPlex-7050:~/work/vsomeip/examples/hello_world/build$ VSOMEIP_CONFIGURATION=../helloworld-local.json \
> VSOMEIP_APPLICATION_NAME=hello_world_client \
> ./hello_world_client
1 Configuration module could not be loaded!


Error fix:
will@will-OptiPlex-7050:~/work/vsomeip/examples/hello_world/build$ sudo ldconfig

按照readme的说明,直接copy执行命令来运行,要说明的是
1.vsomeip的配置需要import自己的JSON文件,否则会用到系统自带的default配置;
2.第一执行的时候会遇到配置模块无法加载的问题,执行一下 sudo ldconfig就能解决

1. 先运行服务端的APP

Run vsompip server side first:
will@will-OptiPlex-7050:~/work/vsomeip/examples/hello_world/build$ VSOMEIP_CONFIGURATION=../helloworld-local.json \
> VSOMEIP_APPLICATION_NAME=hello_world_service \
> ./hello_world_service

log会有 如下打印

2023-11-01 11:11:42.288696 [info] Using configuration file: "../helloworld-local.json".
2023-11-01 11:11:42.289278 [info] Parsed vsomeip configuration in 0ms
2023-11-01 11:11:42.289336 [info] Configuration module loaded.
2023-11-01 11:11:42.289392 [info] Security disabled!
2023-11-01 11:11:42.289424 [info] Initializing vsomeip (3.4.9.1) application "hello_world_service".
2023-11-01 11:11:42.289804 [info] Instantiating routing manager [Host].
2023-11-01 11:11:42.290299 [info] create_routing_root: Routing root @ /tmp/vsomeip-0
2023-11-01 11:11:42.290997 [info] Application(hello_world_service, 4444) is initialized (11, 100).
2023-11-01 11:11:42.291277 [info] Starting vsomeip application "hello_world_service" (4444) using 2 threads I/O nice 255
2023-11-01 11:11:42.291740 [info] Client [4444] routes unicast:134.86.56.94, netmask:255.255.255.0
2023-11-01 11:11:42.291761 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值