tmux and netcat listener Linux question
Recently I picked up a new NB-IoT project, and started playing around again, with Linux and some NB-IoT and CAT-M1 devices.
There are somethings I don’t understand. Maybe someone here does.
I created some listeners and parsers on a Linux machine. I configure 2 devices to connect to them. It is all quick and dirty coding, but I get the devices to connect and send data.
On linux, I listen to TCP and I redirect incoming data to a file with
with the command
netcat -k -l [port] > netcat.pcap
I start the listener with
tmuxso that I can detach from the session and keep the listener running headless
It seems that one listener can only serve one device. Is that correct? I am used to Apache Webserver, that can handle as many devices (browsers) that you want. But that is HTTP. If I point 2 devices to the same port, I get only the data from 1 device. Or am I doing something wrong / thinking in the wrong direction?
Another question. each device connects to it’s own port. For current testing, that is good enough. (remember, I run the listener headless.) Yet it also seems the listener can get ‘corrupted’ or so. I then need to restart the netcat listener. Does anyone have any experience with this?
Yes, thats true. I also made the same observations. For such “advanced” testing purposes, I strongly recommend to use python using the socket library. The easiest way would be to start a new thread for each incoming device and a more advanced setup would be with one thread for incoming traffic and one thread for outgoing traffic using asyncio.
@Kolja-Vornholt Thank you, Kolja!
I am going to look at python. Still, I would expect that when a device has done it’s work, it should nicely close the TCP session and the listerer should be ‘ready for next connection’.
(It’s logical that a listener van not handle 2 devices on the same port at the same time, of course)
Do you also have experience with the listener getting ‘corrupted’? My listener seems perfectly stable as long as my IoT device does not connect to it
@Adriaan This thread continues here: