Using UNIX sockets with Erlang

Jérôme Marant jmarant@REDACTED
Tue Sep 18 23:59:25 CEST 2001


Scott Lystig Fritchie <fritchie@REDACTED> writes:

> 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.

  Of course, UNIX sockets don't work on other platforms than UNIX
  systems. However, you can always make the API behave differently
  with respect to the system it runs on, for instance returning some
  special error codes telling that there is no implementation for the
  function on that on that system.

> 
> 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
> demands.

  Well, it seems that there is such a driver in the examples. However,
  I'd like to see it either as a contrib or as part of the Erlang
  release: there is no doubt that it more usefull than you can
  imagine.

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

  I *really* want to use it. I'm currently coding a lightweight
  PostgreSQL client library in Erlang and I must be able to support
  both UNIX (for local connexions) and INET sockets.

  So yes, please release it ;-)

...
 
> 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.

  I can help, of course ;-)

  Cheers,

-- 
Jérôme Marant <jerome@REDACTED>
              <jerome.marant@REDACTED>



More information about the erlang-questions mailing list