juce/sockproc

docker - can't connect to socket

Closed this issue · 2 comments

I'm having trouble making sockproc work in a docker container. I tested it ok on my mac. Then I built it in an ubuntu docker container. The process appears to start ok, but I can't telnet to the socket.

Here's the command output:

root@311718b99310:/usr/local/bin# ./sockproc /tmp/foo
root@311718b99310:/usr/local/bin# ps aux |grep sock
root        33  0.0  0.0   4364    84 ?        Ss   03:44   0:00 ./sockproc /tmp/foo
root@311718b99310:/usr/local/bin# telnet /tmp/foo
telnet: could not resolve /tmp/foo/telnet: Name or service not known

Ideas or things I can do to help debug? Thanks.

juce commented

i think the problem is that on Ubuntu, telnet does not support unix-domain sockets. In fact, it may be a Mac-only thing... I should probably change the README to have a different example that works on Linux.

Looks like, on Linux, you can use socat to connect to unix domain sockets. Make sure to use "crlf" flag, because sockproc protocol requires '\r\n' line-endings.
So, for example:

root@a569cf4d3a74:/tmp/sockproc# ./sockproc /tmp/foo
root@a569cf4d3a74:/tmp/sockproc# socat - /tmp/foo,crlf
uname -a
0
status:0
98
Linux a569cf4d3a74 4.9.27-moby #1 SMP Thu May 11 04:01:18 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
0

Or you can use sockproc with a listening tcp-socket. Then telnet works:

root@a569cf4d3a74:/tmp/sockproc# ./sockproc 13000
root@a569cf4d3a74:/tmp/sockproc# telnet 127.0.0.1 13000
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
uname -a
0
status:0
98
Linux a569cf4d3a74 4.9.27-moby #1 SMP Thu May 11 04:01:18 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
0
Connection closed by foreign host.

ah - thanks @juce!