从 Java 获取 Ping 到 Erlang
我最近发布了一个类似的 Erlang-Java 相关问题,名为“Java 到 Erlang Messages”。
然后我已经取得了一些进展,并且我已经在两种语言之间建立了稳定的连接并运行(感谢我在 stackoverflow 上发现的一个较旧的问题)。
但我现在的问题是,我只能从 Erlang 向 Java 发送消息并接收它,我在返回消息时遇到了困难。
我必须创建什么才能从 java 发送消息,我什么时候可以发送它?
这是我的一些接收代码。
try {
node = new OtpNode("javambox@localhost", "gui"); // name, cookie
} catch (IOException ex) {
System.exit(-1);
}
...
OtpMbox mbox = node.createMbox("mbox");
while (true) {
OtpErlangObject o = null;
try {
o = mbox.receive();
I recently posted a similar Erlang-Java related question called "Java to Erlang Messages".
I have made some progress sense then, and i've gotten a stable connection up-and-running between the two languages (thanks to a older question that i found on stackoverflow).
But my problem is now that i can only send a message to Java from Erlang and receive it, Im having trouble making a return message.
What do i have to create in order to send a message from java, when can i send it?
This is some of my code for receiving.
try {
node = new OtpNode("javambox@localhost", "gui"); // name, cookie
} catch (IOException ex) {
System.exit(-1);
}
...
OtpMbox mbox = node.createMbox("mbox");
while (true) {
OtpErlangObject o = null;
try {
o = mbox.receive();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以在这里找到一个例子
http:// pdincau.wordpress.com/2010/01/07/how-to-create-a-java-erlang-node-with-jinterface/
you can find an example here
http://pdincau.wordpress.com/2010/01/07/how-to-create-a-java-erlang-node-with-jinterface/