There are some great communication protocols (MQTT, RabbitMQ, ReDis …) that are excellent for passing data between nodes. For applications where you

Simple TCP/UDP Bash Apps – Fun Tech Projects

submited by
Style Pass
2021-03-07 06:38:46

There are some great communication protocols (MQTT, RabbitMQ, ReDis …) that are excellent for passing data between nodes.

For applications where you only need to do simple communications a couple of lines of Bash can be used with TCP or UDP sockets.

Unfortunately Linux device connections are not fully reliable, especially on the read or listening side. However the write component appears to be fairly solid. Luckily there is a solid solution using the nc (NetCat) command line utility. The nc utility is typically preloaded on most Linux systems.

To setup a UDP listener, use the IP address of the listener node, and select the -k option to allow multiple connections to occur:

When the script echos an integer the progress bar will be updated with the integer value. An echo string starting with a “#” will update the text above the bar.

The progress bar is from 0-100%, but the integer value can be re-scaled to make the information clearer. For example to re-scale 0-60 secs to 0-100:

Leave a Comment