Access data sent to host machine (send to host's IP and port)

Hi guys,

I would like to enable my container to access data that is sent my my LIDAR to my host machine, i.e. to the port 2368 of the IP address of my host machine.

I have a LIDAR connected to my host machine through an Erhternet cable. The lidar has an IP address like 192.168.1.201 and my host machine has an address like 192.168.1.100, the LIDAR sends data to the ip address of my host machine 192.168.1.100 and to the port 2368.

Now I am running a docker container in my host machine, I would like to enable my container to access the data sent by my lidar.

I tried using -network=host, but when I monitor the port 2368 in my container, I see no data coming in.

I’m not sure I understand it. What is your container doing? Does it monitor the network or you mean there is a process listening on port 2368 in the container?

And what is your host mechine? What OS what version?

hi @rimelek ,

Thanks for your reply. Let mew clarify my question.

Background: A LIDAR is connected to my host machine through an Ethernet cable. After configuring the LIDAR, it sends data to the ip address of my host machine with the port being 2368.

Objective: I run a ros2 pkg in a container (with --network=host) on my host machine that tries to access the data sent by the LIDAR to my host machine. However, I need to specify the IP address of the sender, i.e. the LIDAR, and and the port of coming.

Issue: There is no output from that pkg. Then, I try to listen to the port 2368 in the container. There is also nothing.

Env: Host - Ubuntu 22, lastest Docker Desktop (updated this week), Image- Ubuntu 22.

To receive TCP packets inside a container, you need to use --publish to publish ports on the host or --network=host. And your application inside the container should listen on 0.0.0.0:port.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.