[erlang-questions] Unix domain sockets

Tony Rogvall <>
Fri Mar 21 09:59:14 CET 2014


I did implement this a while ago

https://github.com/tonyrog/afunix

It is basically a specialized version of inet driver, using the same internal protocol and register in a 
way the gen_tcp api may be used directly. The drawback with this a approach is of course that this
driver must be updated every time the inet driver is updated, but I can not really se any other way
of doing this right now.

The api is very simple (afunix still lack any kind of documentation) and 
differ from gen_tcp only in the listen and connect functions.

afunix:listen(Name, Options)
afunix:connect(Name, Options)

The afunix specific functions are

afunix:get_peercred(Socket)
afunix:get_peerid(Socket)

Hope that it can be useful.

/Tony


On 21 mar 2014, at 05:32, Michael Truog <> wrote:

> I also am disappointed that unix domain sockets lack support, but I am also disappointed there are more internal checks to prevent their use now.  I have been able to graft on support, but it isn't pretty (since it needs to avoid the internal prim_inet checks):
> https://github.com/CloudI/CloudI/blob/master/src/lib/cloudi_core/src/cloudi_services_external.erl#L1342-L1375
> https://github.com/CloudI/CloudI/blob/master/src/lib/cloudi_core/cxx_src/cloudi_socket_drv.cpp
> 
> When I add unix domain sockets this way, I do get an internal ERTS thread stuck at 100% CPU (somehow stuck in a tight loop) for unknown reasons, but it works fine otherwise.
> 
> On 03/19/2014 04:13 PM, James wrote:
>> 
>> five years later... and there is still no support for uds, only the uds_dist example, which does not even build on linux as it was evidently created for solaris. 
>> 
>> 
>> 
>> 
>> On Wednesday, March 4, 2009 5:23:21 AM UTC-5, rvirding wrote:
>> I just saw a lament in twitter that Erlang doesn't support Unix domain sockets. Is that so? If not is there a nice link to some documentation explaining that we do and how to do it?
>> 
>> Robert
>> 
>> -- 
>> Remember to send a copy to erlang (dot) questions (at) erlang (dot) org when posting.
>> --- 
>> You received this message because you are subscribed to the Google Groups "Erlang Programming" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to 
>> To post to this group, send email to 
>> Visit this group at http://groups.google.com/group/erlang-programming.
>> For more options, visit https://groups.google.com/d/optout.
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions

"Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix"



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140321/afbee19b/attachment.html>


More information about the erlang-questions mailing list