I've got two programs in different languages attempting to connect to a local abstract socket on a Linux system. One of the two is failing. I am having difficulty determining why. I just want to know what the one difference I can find in the strace
output means, so I can fix it.
The working one has this strace
output:
socket(PF_LOCAL, SOCK_SEQPACKET, 0) = 3
connect(3, {sa_family=AF_LOCAL, sun_path=@"qwertystop.bus.8"}, 19) = 0
The nonworking has this strace
output:
[pid 6307] socket(PF_LOCAL, SOCK_SEQPACKET, 0) = 13
[pid 6307] connect(13, {sa_family=AF_LOCAL, sun_path="qwertystop.bus.8"}, 19) = -1 ENOENT (No such file or directory)
There are three differences: The nonworking one is from a program with multiple pids, the return value of the connect
call is different, and the working one has a @
before the sun_path
string. I presume that whatever causes the @
to be missing is also what caused the failure, since it makes little sense for socket connection to not work in a process just because it was started by a different process.
(I am explicitly not requesting a general solution to "connect to an abstract socket", which is why I am not stating the languages. Mostly because this is homework and I refuse to create a situation which might tempt me to copy code directly.)
Meaning determined. It means the string is preceded by a null byte. Or possibly just a non-printing character, or it's signifying that the socket is abstract.