I have a specific service that sends data on port 5555. I need to open socket on shell unix to listen on this port and print output on shell. Service is deployed as docker container. So, I run container binding port 5555:5555.
I tried to run nc -l localhost 5555 on my host but it not work.
I tried to open container shell and run netstat. This is the output:
# netstat
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:epmd localhost:49664 ESTABLISHED
tcp 0 0 localhost:49664 localhost:epmd ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags Type State I-Node Path
unix 3 [ ] STREAM CONNECTED 98194
unix 3 [ ] STREAM CONNECTED 98193
unix 3 [ ] STREAM CONNECTED 99655
I'm sure that service sends data but I cannot receve. Can you help me? Thanks
localhostaddress or on an actual IP on an (bridge)-interface?5555:5555in docker run comand. I prefer to listen from remote host but to be able to listen from localhost can be a first good result. Can nc -l localhost 5555 used to listen from Unix socket? Thanks-uto listen on UDP sockets,-Ufor unix domain sockets.. I add -u and -p option. Now, It does not work from remote host. Usingnc -u -l remoteIP -p 5555``` I dont' receve anything. Reading documentation is not necessary set particulary option to listen from remote host. I'm able to connect to remoteIP.nc -l -u IP PORTtolistenand useudp, then bind (locally) to theIPon portPORT. When you want to receive data from a remote host,IPcannot belocalhostbut must be the address of an actually connected interface.