erlang: UNIX domain socket support?
Erlang/OTP comes with drivers for tcp and udp sockets only. So...
No.
Third part drivers
- unixdom_drv in http://jungerl.sourceforge.net/
- uds_dist in the source tree's driver examples
- procket at https://github.com/msantos/procket
How do unix domain sockets work in Erlang 19
I've not tried the official release 19, but I can make it work using the latest git (as of July 7th) by:
- disabling active with
{active, false}
- using UNIX-SENDTO instead of UNIX-CONNECT
- binding socat's socket to its own address (not binding creates an error on erlangs side when resolving the address.)
Demonstration:
console 1:
$ rm /tmp/socket*
$ erl
Erlang/OTP 19 [erts-8.0.1] [source-ca40008] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V8.0.1 (abort with ^G)
1> {ok, Port} = gen_udp:open(0, [{active, false},{ifaddr, {local,"/tmp/socket2"}}]),
1> io:format("ok~w ~w~n", [ok,Port]),
1> gen_udp:recv(Port, 2).
okok #Port<0.451>
console 2:
$ echo "hi" | socat - UNIX-SENDTO:/tmp/socket2,bind=/tmp/socket1
console 1 results:
okok #Port<0.451>
{ok,{{local,<<"/tmp/socket1">>},0,"hi\n"}}
How to do IPC using Unix Domain Socket in D?
After binding, you actually need to accept
. It will return a new Socket instance which you can actually receive
from. Your client side branch looks ok. I think that is your key mistake here.
I also have a code sample in my book that shows basic functionality of std.socket which can help as an example:
http://arsdnet.net/dcode/book/chapter_02/03/
it is tcp, but making it unix just means changing the family, like you already did in your code.
You can also look up socket tutorials for C and so on, the D socket is just a thin wrapper around those same BSD style socket functions.
Same Machine Erlang communication
R1. It uses TCP/IP (in fact, there isn't any "standard" support for UNIX domain sockets)
R2. I am pretty sure it is still TCP/IP sockets
R3. see R2
R4. There is a binary exchange format proper to Erlang and it is message based. Exchanges can either be sync (RPC-like) or async.
R5. No master.
As bonus (to help you save time): don't forget to use a registered name (-sname or -name) in order to use inter-node communications (either RPC or whatever).
Having dotnet core 2.0.0 Socket.Listen() support UNIX Domain Socket?
It looks like @stephentoub replied with the answer on your corresponding GitHub issue.
Did you try SocketType.Stream instead of SocketType.Dgram?
Related Topics
Merge/Join Two Tables Fast Linux Command Line
Interrupt Handling and User Space Notification
How to Check a File Exists and Execute a Command If Not
How to Force Node.Js Require to Be Case Sensitive
What Does "$" Give Us Exactly in a Shell Script
Add Some Specific Time While Using the Linux Command "Date"
Linux Terminal: How to Capture or Watch Other Terminal Session
How to Disable Editing My History in Bash
Count Files and Directories Using Shell Script
Calculating Rounded Percentage in Shell Script Without Using "Bc"
How to Specify Time in Cron Considering Year
How to Redirect from Audio Output to Mic Input Using Pulseaudio
Determine Usb Device File Path
One Liner to Rename Bunch of Files
Systemd: Start Service at Boot Time After Network Is Really Up (For Wol Purpose)
List Files Recursively in Linux Cli With Path Relative to the Current Directory
Apache Pig: Load a File That Shows Fine Using Hadoop Fs -Text