Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
585 views
in Technique[技术] by (71.8m points)

c++ - vsomeip configuration file for client and server

I am unable to establish communication between server and client when using seperate JSON configuration files for client and server My requirement is to transmit SOME/IP data using the vsomeip framework. I am transmitting the data on the same system. However, I am able to transmit data when using the same JSON file for transmitter and receiver. Below is the JSON file used.

{
    "unicast" : "160.48.199.102",
    "logging" :
    { 
        "level" : "trace",
        "console" : "true",
        "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" },
        "dlt" : "false"
    },
    "applications" : 
    [
        {
            "name" : "master_tx",
            "id" : "0x1277"
        },
        {    
            "name" : "master_rx",
            "id" : "0x1344"
        }
    ],
    "services" :
    [
        {
            "service" : "0x3556",
            "instance" : "0x0001",
            "reliable" : { "port" : "30490", "magic-cookies" : "false" },
            "events" : 
            [
                {
                    "event" : "0x8001",
                    "is_field" : "true",
                    "is_reliable" : "false"
                }
            ]
        }
    ]
    "max-payload-size" : "5000",
    "max-payload-size-unreliable" : "5000",
    "routing" : "master_tx",
    "service-discovery" :
    {
        "enable" : "true",
        "port" : "30490",
        "protocol" : "_udp_",
        "initial_delay_min" : "100",
        "initial_delay_max" : "200",
        "repetitions_base_delay" : "200",
        "repetitions_max" : "15",
        "ttl" : "100",
        "cyclic_offer_delay" : "2000",
        "request_response_delay" : "1500"
    }
}

But, when using different JSON files for transmitter and receiver, I am not able to establish any connection. Below are the JSON files used.

server.json

{
    "unicast" : "192.168.0.178",
    "logging" :
    { 
        "level" : "trace",
        "console" : "true",
        "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" },
        "dlt" : "false"
    },
    "applications" : 
    [
        {
            "name" : "master_tx",
            "id" : "0x1277"
        }
    ],
    "services" :
    [
        {
            "service" : "0x3556",
            "instance" : "0x0001",
            "reliable" : { "port" : "30490", "magic-cookies" : "false" },
            "events" : 
            [
                {
                    "event" : "0x8001",
                    "is_field" : "true",
                    "is_reliable" : "false"
                }
            ],
            "eventgroups" :
            [
                {
                    "eventgroup" : "0x001",
                    "events" : [ "0x8001" ]
                }
            ]
        }
    ],
    "max-payload-size" : "5000",
    "max-payload-size-unreliable" : "5000",
    "routing" : "master_tx",
    "service-discovery" :
    {
        "enable" : "true",
        "port" : "30490",
        "protocol" : "_udp_",
        "initial_delay_min" : "100",
        "initial_delay_max" : "200",
        "repetitions_base_delay" : "200",
        "repetitions_max" : "15",
        "ttl" : "100",
        "cyclic_offer_delay" : "2000",
        "request_response_delay" : "1500"
    }
}

client.json

{
    "unicast" : "192.168.0.178",
    "network" : "vsomeip-rx",
    "logging" :
    { 
        "level" : "trace",
        "console" : "true",
        "file" : { "enable" : "false", "path" : "/tmp/vsomeip.log" },
        "dlt" : "true"
    },
    "applications" : 
    [
        {    
            "name" : "master_rx",
            "id" : "0x1344"
        }
    ],
    "clients" :
    [
        {
            "service" : "0x3556",
            "instance" : "0x0001",
            "unreliable" : [ "30490" ]
        }
    ],
    "max-payload-size" : "5000",
    "max-payload-size-unreliable" : "5000",
    "routing" : "master_rx",
    "service-discovery" :
    {
        "enable" : "true",
        "port" : "30490",
        "protocol" : "_udp_",
        "initial_delay_min" : "100",
        "initial_delay_max" : "200",
        "repetitions_base_delay" : "200",
        "repetitions_max" : "15",
        "ttl" : "100",
        "cyclic_offer_delay" : "2000",
        "request_response_delay" : "1500"
    }
}

Can someone please help me if something is wrong in JSON files or if I am missing something else.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

server.json

  1. Port 30490 is defined as reliable whereas it is used as a service discovery port (which is unreliable). Use other one like 30500.
  2. I'm not sure if a "_udp_" is allowed value - "udp" for sure is.

client.json

  1. "clients" tag specifies the ports that shall be used to connect to a specific service. In this case again only one port is used 30490 which is already defined for service discovery. Additionally in the client it is specified as unreliable whereas it is reliable in the server. Beside as specified in documentation: vsomeip will take the first free port of the list. If no free port can be found, the connection will fail. Try with other port or remove "clients" tag for tests.

  2. I'm not sure if a "_udp_" is allowed value - "udp" for sure is.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...