当为客户端和服务器使用单独的JSON配置文件时,我无法在服务器和客户端之间建立通信我的要求是使用vsomeip框架传输SOME/IP数据。我在同一个系统上传输数据。然而,当使用相同的JSON文件作为发送器和接收器时,我能够传输数据。下面是使用的JSON文件。
{
"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"
}
}
但是,当发射器和接收器使用不同的JSON文件时,我无法建立任何连接。下面是使用的JSON文件。
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"
}
}
如果JSON文件中出现错误或我缺少其他内容,有人能帮我吗。
server.json
- 端口30490被定义为可靠,而它被用作服务发现端口(不可靠(。使用另一个,如30500
- 我不确定"_udp">是允许的值-"strong>";udp"当然是
client.json
-
";客户端";标签指定了应用于连接到特定服务的端口。在这种情况下,再次仅使用30490一个端口,该端口已经被定义用于服务发现。此外,在客户端中,它被指定为不可靠,而在服务器中它是可靠的。除了文档中指定的:vsomeip将占据列表的第一个自由端口。如果找不到可用端口,则连接将失败尝试使用其他端口或删除";客户端";标签进行测试。
-
我不确定"_udp">是允许的值-"strong>";udp"当然是。
Hm,很难。我认为端口30490是为ServiceDiscovery保留的(由vsomeip守护进程使用(。因此,应用程序的重用可能会导致问题。
但我想说的是,这里的主要问题是您使用可靠的端口(这意味着TCP(用于服务";0x3556";在server.json中,在client.json中有一个不可靠端口(UDP(。也许这就解决了问题。