Using UNIX sockets with Erlang

Scott Lystig Fritchie fritchie@REDACTED
Tue Sep 18 20:30:06 CEST 2001

>>>>> "jm" == =?iso-8859-1?q?J=E9r=F4me?= Marant <jerome.marant@REDACTED> writes:

jm> I'd like to use UNIX socket with Erlang but I did not find any
jm> module (both within the release and in contribs) supporting this.

I haven't picked apart the R8 pre-release to see if UNIX domain
sockets were supported.  They are not in R7 and previous releases.  If
I recall correctly, they aren't supported because they aren't portable
to all platforms the Erlang VM runs on.  Someone more official could
probably give an official explanation.

When I was at Sendmail I wrote a UNIX domain socket driver.  It works
(for the RPC application we were working on at that time), but it
doesn't implement a lot of things that the TCP driver does (e.g. all
the {packet, PacketType} encoding types).  It's based on the TCP
driver code, so eventually we need to bundle it up into a useful
distribution and recontribute it back to the community as the license

If you're really, *really* itching to use it, I can try putting the
source together into something sortof-useful.  Let me know.

Here's a not-so-casual observation: the current implementation of the
Sendmail UNIX domain socket driver sends messages such as:

    {unixdom, Socket, Data}, {unixdom_closed, Socket},
    {unixdom_error, Socket, Reason}

... mimicing:

    {tcp, Socket, Data}, {tcp_closed, Socket}, {tcp_error, Socket, Reason}

However, it was a real pain to take code already written for TCP use
and use UNIX domain sockets instead: all the message pattern matching
had to be edited.  In contrast, the underlying API for stream-type
sockets is the same regardless of the family used.  Ditto for
datagram-type sockets.


More information about the erlang-questions mailing list