I'm trying to setup a simple TCP server in bash that can listen for request, process the data received and then send a response to the client.
Is there any way to do this properly using netcat ?
edit - what i've have already tried :
- Piping the output of the server to a bash script :
nc -kl 4444 | bash pipe.sh
Then, in pipe.sh, read the answer. But there is some downside to this : sometimes read is acting weirdly and do not get the full output, and I couldn't find a way to send a response to the client. - Something more complete looking like this, however it causes some problems as it's meant to be interactive and wait for user input, so sometimes the server answers 2 times or simply doesn't answer anything.