I have a socket server which creates unix socket and then reads data from this unix socket. Then I have another long-process application and I want to redirect stdout of this process to my unix socket. I tried this command to test
ping 127.0.0.1 > /tmp/unixsockettest.sock
But I get -bash: /tmp/unixsockettest.sock: No such device or address
. Is it possible to redirect application output to unix socket?
larsks :
You can't redirect out to a Unix socket using shell i/o redirection, but you can use a tool like socat (which is probably packaged for your distribution) to accomplish the task:\nping 127.0.0.1 | socat - unix-connect:/tmp/unixsockettest.sock\n",
2022-12-03T18:09:00