1

I'm trying to debug why data isn't being sent over a Unix Domain Socket.

I have 2 applications which should be communicating over a UDS but aren't.

To test I've done the following:

Using socat, I listen on a socket like this:

socat -x -u UNIX-RECV:/tmp/dd.sock STDOUT

and using netcat to send data like this:

echo "hello" | nc -U -w1 /tmp/dd.sock

nothing happens.

But if I also set up socat as a proxy, to listen to a UDP port, and write that to the socket like this:

socat -s -u UDP-RECV:9988 UNIX-SENDTO:/tmp/dd.sock

Then sending via netcat to the UDP port works:

echo "Hello" | nc -u localhost 9988

I've also been able to get my client application to write UDP to the proxy and it's successful where is wasn't when writing to the unix socket.

I would like to understand why socat doesn't receive data written to it by nc, but does if I proxy over UDP.

Using Amazon Linux 4.14.101-75.76.amzn1.x86_64

1
  • @RuiFRibeiro . I mentioned the applications for background. My example which demonstrates the problem using socat and nc reproduces the problem. I shall update the question to make the question more clear.
    – Will
    Apr 3, 2019 at 13:27

1 Answer 1

1

You have set up a listening datagram socket with socat+UNIX-RECV: and are attempting to talk to it via a stream socket with nc.

The second scenario works because in that case you added the missing -u flag to nc, so that both it and socat were employing a datagram socket. It wasn't anything to do with there being a proxy.

Further reading

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .