Hello,
We want to create a simulator server (accepting clients on tcp port 4560, refer to image below) not on localhost.

In simulator_mavlink.cpp we see that the client connects to _myaddr, which is initialized to:
_myaddr.sin_addr.s_addr = htonl(INADDR_ANY);
As we understand, INADDR_ANY is normally routed to loopback address. Hence, our question is, how do we define our own ip?
Thanks,
Eyal
Hi Eyal,
We ran into exactly the same problem. I have sent a pull request with our solution here: https://github.com/PX4/Firmware/pull/15443
Afterwards you can set the desired host in your rcS startup script (Firmware/ROMFS/px4fmu_common/init.d-posix/rcS), by changing simulator start -c $simulator_tcp_port into simulator start -t "192.168.178.122" $simulator_tcp_port.
Hope this helps!
Regards,
Peter
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.
Most helpful comment
Hi Eyal,
We ran into exactly the same problem. I have sent a pull request with our solution here: https://github.com/PX4/Firmware/pull/15443
Afterwards you can set the desired host in your rcS startup script (Firmware/ROMFS/px4fmu_common/init.d-posix/rcS), by changing
simulator start -c $simulator_tcp_portintosimulator start -t "192.168.178.122" $simulator_tcp_port.Hope this helps!
Regards,
Peter