tmux and netcat listener Linux question



  • Hello all,

    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 tmux so 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?

    Thank you.

    Adriaan



  • Hi Adriaan,

    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.

    BR,
    Kolja