我用:
启动我的Erlang节点erl -sname erlangNode -cookie secret
P = spawn( fun() -> receive _ -> io:format("gotit") end end).
register(java_server, P).
然后我运行我的java节点客户端代码:
OtpNode node = new OtpNode("bingo", "secret");
OtpMbox mbox = node.createMbox("com");
System.out.println( node.ping("erlangNode@localhost",2000) );
mbox.send("java_server", "localhost",new OtpErlangAtom("hej"));
但是Erlang进程java_server永远不会收到消息。有什么问题?
答案 0 :(得分:1)
您的java节点在ping消息上输出是否为true? 也许你忘了在send发送整个节点名称?
mbox.send("java_server", "erlangNode@localhost",new OtpErlangAtom("hej"));