bash unix socket
This commit is contained in:
parent
c07cd75d39
commit
0575eaa4cc
17
~/Bash/unix-socket-server.sh
Executable file
17
~/Bash/unix-socket-server.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# TCP
|
||||||
|
#coproc nc -l localhost 3000
|
||||||
|
|
||||||
|
# UnixSocket
|
||||||
|
coproc nc -l -U ./app.sock
|
||||||
|
|
||||||
|
while read -r cmd; do
|
||||||
|
case $cmd in
|
||||||
|
d) date ;;
|
||||||
|
q) break ;;
|
||||||
|
*) echo 'Try again?'
|
||||||
|
esac
|
||||||
|
done <&"${COPROC[0]}" >&"${COPROC[1]}"
|
||||||
|
|
||||||
|
kill "$COPROC_PID"
|
Loading…
Reference in New Issue
Block a user