<div dir="ltr"><div style>Hello</div><div style><br></div><div style>I write implementation of Erlang Distribution Protocol for Go:  </div><div style><a href="https://github.com/metachord/eclus/blob/dist/src/erlang/node/node.go">https://github.com/metachord/eclus/blob/dist/src/erlang/node/node.go</a><br>

</div><div style><a href="https://github.com/metachord/eclus/blob/dist/src/erlang/node/gen_server.go">https://github.com/metachord/eclus/blob/dist/src/erlang/node/gen_server.go</a><br></div><div style><br></div><div style>

Now this implementation can publish its port via epmd (or other daemon, like eclus), establish incoming connection from Erlang node, parse messages, pass them to registered or not registered goroutines on local node. But I cannot send message to remote node while it seems all is ok:</div>

<div style><br></div><div style>Incoming call to `net_kernel` process:</div><div><br></div><div>2013/01/21 12:24:31 NET_KERNEL: HandleCall: term.Tuple{"is_auth", "asd@localhost"}, From: term.Tuple{term.Pid{Node:"asd@localhost", Id:0x26, Serial:0x0, Creation:0x1}, term.Reference{Node:"asd@localhost", Creation:0x1, Id:[]uint32{0x32, 0x0, 0x0}}}</div>

<div><br></div><div><br></div><div style>Process replied (atom 'yes'):</div><div style> </div><div>2013/01/21 12:24:31 Send: term.Pid{Node:"asd@localhost", Id:0x26, Serial:0x0, Creation:0x1}, term.Tuple{term.Reference{Node:"asd@localhost", Creation:0x1, Id:[]uint32{0x32, 0x0, 0x0}}, "yes"}</div>

<div><br></div><div><br></div><div style>Find connection with node 'asd@localhost' and send data to this connection:</div><div style><br></div><div>2013/01/21 12:24:31 Send to remote node: term.Pid{Node:"asd@localhost", Id:0x26, Serial:0x0, Creation:0x1}, node.nodeConn{conn:(*net.TCPConn)(0x18745858), wchan:(chan []term.Term)(0x18799000)}</div>

<div><br></div><div style>Write terms to socket:</div><div style><br></div><div>2013/01/21 12:24:31 WRITE: []term.Term{term.Tuple{2, "", term.Pid{Node:"asd@localhost", Id:0x26, Serial:0x0, Creation:0x1}}, term.Tuple{term.Reference{Node:"asd@localhost", Creation:0x1, Id:[]uint32{0x32, 0x0, 0x0}}, "yes"}}: []byte{0x70, 0x83, 0x68, 0x3, 0x61, 0x2, 0x64, 0x0, 0x0, 0x64, 0x0, 0xd, 0x61, 0x73, 0x64, 0x40, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x0, 0x0, 0x0, 0x26, 0x0, 0x0, 0x0, 0x0, 0x1, 0x83, 0x68, 0x2, 0x64, 0x0, 0xd, 0x61, 0x73, 0x64, 0x40, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x1, 0x0, 0x0, 0x0, 0x32, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x64, 0x0, 0x3, 0x79, 0x65, 0x73}</div>

<div><br></div><div><br></div><div style>Raw bytes written:</div><div style><br></div><div>2013/01/21 12:24:31 Write to enode:</div><div>   [0 0 0 72 112</div><div>    131 104 3 97 2 100 0 0 100 0 13 97 115 100 64 108 111 99 97 108 104 111 115 116 0 0 0 38 0 0 0 0 1</div>

<div>    131 104 2 100 0 13 97 115 100 64 108 111 99 97 108 104 111 115 116 1 0 0 0 50 0 0 0 0 0 0 0 0 100 0 3 121 101 115]</div><div><br></div><div style>But on 'asd@localhost' node i see:</div><div style><br></div>

<div style><div>=ERROR REPORT==== 21-Jan-2013::12:24:31 ===</div><div>Invalid distribution message: {2,'','asd@localhost'}</div><div><br></div><div><br></div><div style>Can you help me? File erts/emulator/beam/dist.c contains many goto to label invalid_message, which prints this message, so I cannot find real matched clause for this case.</div>

<div style><br></div><div style>Thank you</div></div><div><br></div>-- <br>Max Treskin
</div>