I have a server listening on a socket file /tmp/any.sock
and I want to write something to that socket. If it would be listening on a port, I would use echo mymessage | nc localhost 1234
, but nc /tmp/any.sock
or echo mymessage > /tmp/any.sock
does not work.
You can use
nc
for it as well with the-U
option.Example
Open listening socket in one terminal
Input of data on the other terminal:
Watch the
mytext
being printed on the first terminal. By defaultnc
stops listening after an End-of-File character, but I assume your server can decide on its own.