apt-get install ucspi-tcp
This pacakge contains this list of tools
Create tcp server from bash using
tcpserver command from
# script.sh content
# read MESSAGE
echo "message: $MESSAGE"
echo " message 2"
echo " message 3"
# ---- end ------- #
# Run tcpserver:
tcpserver -v -H -R IP PORT script.sh
# Open a connection:
echo "" | nc IP PORT
This tcp server can open multiple connections in parallel. Verry usefull when you want to have a mock tcpserver.
readcommand doesn't work if I add it in the script(I had a client written in C++). But it did work when my client was
The fix was to add
\n at the end of the string that I was sending from that client. To reproduce this, you can run a client like this:
echo -n "sa" | nc IP PORT and the script should contain a
read instruction. You will notice that the server will stop at that