I am trying to create a socket where the client receives a response based on their request, but I can not figure out how to achieve this on CentOS 7.
Until now I have the socket opened on port 100 and saving the client request in a file:
#!/bin/sh nc -lvk 188.8.131.52 100 > port100.txt 2>&1
As client I send the request:
echo "Hello" | nc 184.108.40.206 100
And the file is populated with:
Ncat: Version 6.40 ( http://nmap.org/ncat ) Ncat: Listening on 220.127.116.11:100 Ncat: Connection from 18.104.22.168. Ncat: Connection from 22.214.171.124:47578. Hello
I want the client receive the response based on the query, if the request is Hello, then receive World, if World then Hello. How can I do that?