Reputation: 129
I have set up a server with the usual nc - lk <port>
command.
My client sends tcp data to the server socket in the form of xxx,yyy which are numbers.
I want every time the client connects that the values of xxx and yyy would be stored in variables in order to use them later.
From what I understood I must work with pipes, but I am not sure how to do this.
Upvotes: 1
Views: 3083
Reputation: 27704
You have two options:
For example:
nc -lk 8889 | while IFS=, read -a p
do echo ${p[1]} ${p[0]}
done
Upvotes: 2