-
Notifications
You must be signed in to change notification settings - Fork 695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HELP: Routing error between two Raspberry Pis #746
Comments
Please also provide the network settings (ip a, ip r) on both nodes. It seems they do not match the configured values and therefore vsomeip uses the local network interface (lo). |
Thank you for your reply! Node 192.169.178.104 (server): Node 192.168.178.141 (client): I have also included my config files (vsomeip_server.json, vsomeip_client.json) if those can help. |
It seems it does not read the configuration files (permissions / path). Do you seem something like: |
Please excuse my late response @lutzbichler. I have provided all the logs in the issue. |
vSomeip Version
v3.4.10
Boost Version
1.74.0.3
Environment
Debian 12 (Raspberry Pi OS)
Describe the bug
Simple request/response method between two Raspberry Pi 4.
Config files are adjusted, but Client routes unicast: 127.0.0.1.
This likely is the reason for "[error] Routing info for remote service could not be found", but I am not sure.
It also seems like as if the application ids from the config files are not used either and instead given the standard value "0100".
I think that my config files are not being read properly, but again, I am uncertain if that is the case.
Maybe the routing is not working because i did this to solve the build issue i had.
These error do not occur when I run the server and client on my pc througt localhost, only when I try to communicate between my Raspberry Pis.
I have already tried many solutions which were suggested in prior issues, but feel free to link me a certain issue if you think it might help. Otherwise feel free to comment, every message is highly appreciated.
Here is the code of all relevant files, alternatively you can download my code here:
vsomeip_client.json:
{
"unicast": "192.168.178.141",
"logging": {
"level": "debug"
},
"applications": [
{
"name": "HelloWorldClient",
"id": "0x5678"
}
],
"services" :
[
{
"service" : "0x1234",
"instance" : "0x5678",
"unicast" : "192.168.178.104",
"unreliable" : "30509"
}
],
"routing" : "HelloWorldClient",
"service-discovery" :
{
"enable" : "true",
"multicast" : "224.224.224.245",
"port" : "30490",
"protocol" : "udp",
"initial_delay_min" : "10",
"initial_delay_max" : "100",
"repetitions_base_delay" : "200",
"repetitions_max" : "3",
"ttl" : "3",
"cyclic_offer_delay" : "2000",
"request_response_delay" : "1500"
}
}
vsomeip_server.json:
{
"unicast": "192.168.178.104",
"logging": {
"level": "debug"
},
"applications": [
{
"name": "HelloWorldServer",
"id": "0x1234"
}
],
"services": [
{
"service": "0x1234",
"instance": "0x5678",
"unreliable": "30509"
}
],
"routing" : "HelloWorldServer",
"service-discovery" :
{
"enable" : "true",
"multicast" : "224.224.224.245",
"port" : "30490",
"protocol" : "udp",
"initial_delay_min" : "10",
"initial_delay_max" : "100",
"repetitions_base_delay" : "200",
"repetitions_max" : "3",
"ttl" : "3",
"cyclic_offer_delay" : "2000",
"request_response_delay" : "1500"
}
}
client.hpp:
#ifndef CLIENT_HPP
#define CLIENT_HPP
#include <vsomeip/vsomeip.hpp>
#include
#include
class Client {
public:
Client() : rtm_(vsomeip::runtime::get()), app_(vsomeip::runtime::get()->create_application("HelloWorldClient")) {
app_->init();
}
};
#endif // CLIENT_HPP
server.hpp:
#ifndef SERVER_HPP
#define SERVER_HPP
#include <vsomeip/vsomeip.hpp>
#include
#include
class Server {
public:
Server() : rtm_(vsomeip::runtime::get()), app_(vsomeip::runtime::get()->create_application("HelloWorldServer")) {
app_->init();
}
};
#endif // SERVER_HPP
client.cpp:
#include "client.hpp"
void Client::start() {
app_->register_state_handler(std::bind(&Client::on_state, this, std::placeholders::1));
app->register_message_handler(
vsomeip::service_t(0x1234),
vsomeip::instance_t(0x5678),
vsomeip::method_t(0x0421),
std::bind(&Client::on_message, this, std::placeholders::1)
);
app->start();
}
void Client::on_state(vsomeip::state_type_e state) {
if (state == vsomeip::state_type_e::ST_REGISTERED) {
std::cout << "Client registered successfully." << std::endl;
/* app_->request_service(0x1234, 0x5678);
while (!app_->is_available(0x1234, 0x5678)) {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
} */
send_request();
}
}
void Client::send_request() {
std::shared_ptrvsomeip::message request = vsomeip::runtime::get()->create_request();
request->set_service(0x1234);
request->set_instance(0x5678);
request->set_method(0x0421);
request->set_reliable(false);
app_->send(request);
}
void Client::on_message(const std::shared_ptrvsomeip::message& msg) {
std::shared_ptrvsomeip::payload pl = msg->get_payload();
std::vectorvsomeip::byte_t payload_data(pl->get_data(), pl->get_data() + pl->get_length());
std::string message(payload_data.begin(), payload_data.end());
std::cout << "Received response: " << message << std::endl;
}
int main() {
Client client;
client.start();
//return 0;
}
server.cpp:
#include "server.hpp"
void Server::start() {
app_->register_state_handler(std::bind(&Server::on_state, *this, std::placeholders::1));
app->register_message_handler(
vsomeip::service_t(0x1234),
vsomeip::instance_t(0x5678),
vsomeip::method_t(0x0421),
std::bind(&Server::on_message, *this, std::placeholders::1)
);
app->start();
}
void Server::on_state(vsomeip::state_type_e state) {
if (state == vsomeip::state_type_e::ST_REGISTERED) {
std::cout << "Service registered successfully." << std::endl;
app_->offer_service(0x1234, 0x5678);
}
}
void Server::on_message(const std::shared_ptrvsomeip::message& msg) {
std::shared_ptrvsomeip::payload pl = rtm_->create_payload();
std::shared_ptrvsomeip::message resp = rtm_->create_response(msg);
std::string str("Hello Client!");
std::vectorvsomeip::byte_t pl_data(std::begin(str), std::end(str));
}
int main() {
Server service;
service.start();
//return 0;
}
CMakeLists.txt:
cmake_minimum_required (VERSION 3.13)
project(BA)
set (CMAKE_CXX_FLAGS "-g -std=c++0x")
find_package (vsomeip3 3.4.10 REQUIRED)
find_package( Boost 1.55 COMPONENTS system thread log REQUIRED )
include_directories (
${Boost_INCLUDE_DIR}
${VSOMEIP_INCLUDE_DIRS}
)
add_executable(server ../src/server.cpp)
target_link_libraries(server vsomeip3 ${Boost_LIBRARIES})
target_include_directories(server PUBLIC include)
add_executable(client ../src/client.cpp)
target_link_libraries(client vsomeip3 ${Boost_LIBRARIES})
target_include_directories(client PUBLIC include)
compile.sh:
rm -rf build cmake -Bbuild -DCMAKE_INSTALL_PREFIX=../../install_folder -DCMAKE_PREFIX_PATH=../../install_folder . cmake --build build/
start_client.sh:
VSOMEIP_CONFIGURATION=../config/vsomeip_client.json VSOMEIP_APPLICATION_NAME=HelloWorldClient LD_LIBRARY_PATH=../../install_folder/lib/:$PWD/build/ ./build/client
start_server.sh:
VSOMEIP_CONFIGURATION=../config/vsomeip_server.json VSOMEIP_APPLICATION_NAME=HelloWorldServer LD_LIBRARY_PATH=../../install_folder/lib/:$PWD/build/ ./build/server
Reproduction Steps
Expected behaviour
I expected the client to use the unicast-address from the client config file and not the localhost ip-address.
I also expected the use of my application ids and not "0100".
Logs and Screenshots
Server logs:
2024-07-29 23:29:35.420504 [info] Parsed vsomeip configuration in 0ms
2024-07-29 23:29:35.422320 [info] Configuration module loaded.
2024-07-29 23:29:35.422694 [info] Security disabled!
2024-07-29 23:29:35.423001 [info] Initializing vsomeip (3.4.10) application "HelloWorldServer".
2024-07-29 23:29:35.423664 [info] Instantiating routing manager [Host].
2024-07-29 23:29:35.426606 [info] create_routing_root: Routing root @ /tmp/vsomeip-0
2024-07-29 23:29:35.429229 [info] Service Discovery enabled. Trying to load module.
2024-07-29 23:29:35.438709 [info] Service Discovery module loaded.
2024-07-29 23:29:35.440336 [info] Application(HelloWorldServer, 0100) is initialized (11, 100).
2024-07-29 23:29:35.441159 [info] Starting vsomeip application "HelloWorldServer" (0100) using 2 threads I/O nice 255
2024-07-29 23:29:35.444673 [info] Client [0100] routes unicast:127.0.0.1, netmask:255.255.255.0
2024-07-29 23:29:35.444688 [info] shutdown thread id from application: 0100 (HelloWorldServer) is: 7fac10f180 TID: 5405
2024-07-29 23:29:35.444226 [info] main dispatch thread id from application: 0100 (HelloWorldServer) is: 7fac91f180 TID: 5404
2024-07-29 23:29:35.448821 [info] Watchdog is disabled!
Service registered successfully.
2024-07-29 23:29:35.451467 [info] io thread id from application: 0100 (HelloWorldServer) is: 7fada5e040 TID: 5402
2024-07-29 23:29:35.451564 [info] io thread id from application: 0100 (HelloWorldServer) is: 7fab0ef180 TID: 5407
2024-07-29 23:29:35.454032 [info] vSomeIP 3.4.10 | (default)
2024-07-29 23:29:35.454972 [info] Network interface "lo" state changed: up
2024-07-29 23:29:35.496418 [info] create_local_server: Listening @ /tmp/vsomeip-100
2024-07-29 23:29:35.497883 [info] OFFER(0100): [1234.5678:0.0] (true)
2024-07-29 23:29:45.455556 [info] vSomeIP 3.4.10 | (default)
Client logs:
2024-07-29 23:30:04.890580 [info] Parsed vsomeip configuration in 0ms
2024-07-29 23:30:04.892200 [info] Configuration module loaded.
2024-07-29 23:30:04.892353 [info] Security disabled!
2024-07-29 23:30:04.892466 [info] Initializing vsomeip (3.4.10) application "HelloWorldClient".
2024-07-29 23:30:04.892907 [info] Instantiating routing manager [Host].
2024-07-29 23:30:04.894928 [info] create_routing_root: Routing root @ /tmp/vsomeip-0
2024-07-29 23:30:04.896944 [info] Service Discovery enabled. Trying to load module.
2024-07-29 23:30:04.902296 [info] Service Discovery module loaded.
2024-07-29 23:30:04.903081 [info] Application(HelloWorldClient, 0100) is initialized (11, 100).
2024-07-29 23:30:04.903497 [info] Starting vsomeip application "HelloWorldClient" (0100) using 2 threads I/O nice 255
2024-07-29 23:30:04.905468 [info] Client [0100] routes unicast:127.0.0.1, netmask:255.255.255.0
2024-07-29 23:30:04.905237 [info] main dispatch thread id from application: 0100 (HelloWorldClient) is: 7fb658f180 TID: 5536
2024-07-29 23:30:04.909092 [info] Watchdog is disabled!
Client registered successfully.
2024-07-29 23:30:04.910652 [error] Routing info for remote service could not be found! (0100): [1234.5678.0421] 0001
2024-07-29 23:30:04.905494 [info] shutdown thread id from application: 0100 (HelloWorldClient) is: 7fb5d7f180 TID: 5537
2024-07-29 23:30:04.911294 [info] io thread id from application: 0100 (HelloWorldClient) is: 7fb76d6040 TID: 5534
2024-07-29 23:30:04.911396 [info] io thread id from application: 0100 (HelloWorldClient) is: 7fb4d5f180 TID: 5539
2024-07-29 23:30:04.913263 [info] vSomeIP 3.4.10 | (default)
2024-07-29 23:30:04.914018 [info] Network interface "lo" state changed: up
The text was updated successfully, but these errors were encountered: