'Understanding Socket paths with @ (Abstract Sockets)

What is @ in the socket path?

I am opening a unix socket using LocalServerSocket().

root@device:/dev/socket # netstat -a
.......
Proto RefCnt Flags       Type       State         I-Node Path
Active UNIX domain sockets (servers and established)
unix  2      [ ACC ]     STREAM     LISTENING      37305 @/storage/my_sock
unix  20     [ ]         DGRAM                      7231 /dev/socket/logdw
unix  2      [ ACC ]     SEQPACKET  LISTENING       7234 /dev/socket/logdr
unix  2      [ ACC ]     STREAM     LISTENING       7236 /dev/socket/logd
.......

Unlike for other sockets, my sockets is being prefixed with @. Also, I went and checked /storage partition. I could not find this socket generated there.

My code where I am creating the socket is shown below.

LocalServerSocket lss = new LocalServerSocket("/storage/my_sock");
LocalSocket sock = lss.accept();
InputStream ins = sock.getInputStream();

My idea is to open a local server socket from Java and use to as a communication channel to interact with a native C application. But As the path is invalid, I am not able to achieve this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source