I'm looking at creating a class which accepts a string to define a Unix socket address.
Linux supports three types of addresses for Unix sockets:
- File based addresses (also called named domain addresses)
- Abstract addresses
- Unnamed addresses
The first is the conventional method which works on pretty much all Unices.
The second is only available on Linux. It accepts a name of up to 107 characters which is composed of any binary byte. The convention, though, has been to use a Java-like name such as /com/ubuntu/background/file
as seen in dbus.
The third is used between parent & child (created by fork()
or fork()
+ exec()
.) The parent creates two sockets, one for the parent and one for the child and then uses one to read/write and the child uses the other.
We have well defined schemes for things such as http://
, ftp://
, etc. Are there any such official definitions for AF_UNIX
based sockets?
I could foresee something such as:
local:///<full-path-to-file>
dbus:///<abstract-path>
unnamed:
Note:
A unix:
protocol would work too, but then I could not distinguish between each type supported by Linux with just the protocol.