[SOLVED] Nc listening to local port

Hi everybody, hope to post on the correct section.
I have a router with OpenWrt BarrierBreaker installed and i need to make it listen on a port to save some logs to a file placed on USB.
i managed to make it listen to another host with nc host port >> myfile.txt but i can't make it listen to a local port, the command return an error

root@OpenWrt:~# nc 9220
BusyBox v1.22.1 (2016-04-19 16:13:32 CST) multi-call binary.

Usage: nc [IPADDR PORT]

Open a pipe to IP:PORT


but the same command on a debian pc don't give errors, there is a different syntax for it on openwrt?

# nc --help
  -l, --listen               listen mode, for inbound connects

unfortunately it don't work

root@OpenWrt:~# nc -l 9220
nc: bad address '-l'

i managed to do it with ncat command instead, also udp is working

ncat -u -l -p 9100 >> file.log

By default OpenWrt comes with busybox-nc (the busybox implementation of netcat) which does not support server mode. You need to install GNU netcat.
opkg install netcat


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