From 6ef131c0f901b8b9d598376348862e74738baed6 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 11 Apr 2024 12:49:15 +1000 Subject: [PATCH] SITL: correct diagnostic message about what AirSim-in addr we bound Co-authored-by: Oleksiy Protas --- libraries/SITL/SIM_AirSim.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/SITL/SIM_AirSim.cpp b/libraries/SITL/SIM_AirSim.cpp index abba54027d..989da08420 100644 --- a/libraries/SITL/SIM_AirSim.cpp +++ b/libraries/SITL/SIM_AirSim.cpp @@ -55,12 +55,14 @@ AirSim::AirSim(const char *frame_str) : */ void AirSim::set_interface_ports(const char* address, const int port_in, const int port_out) { - if (!sock.bind("0.0.0.0", port_in)) { + static const char *port_in_addr = "0.0.0.0"; + + if (!sock.bind(port_in_addr, port_in)) { printf("Unable to bind Airsim sensor_in socket at port %u - Error: %s\n", port_in, strerror(errno)); return; } - printf("Bind SITL sensor input at %s:%u\n", "127.0.0.1", port_in); + printf("Bind SITL sensor input at %s:%u\n", port_in_addr, port_in); sock.set_blocking(false); sock.reuseaddress();