[erlang-questions] Receiving identical messages from Erlang and from JInterface
Erlang list
erlang@REDACTED
Thu Jan 4 16:59:36 CET 2007
I am just starting to use Erlang and I've run into something I don't
understand. Here is a transcript of a shell session when I send two
identical messages from a remote Erlang node:
(foo@REDACTED)102> b().
ok
(foo@REDACTED)103> process_info(self(), messages).
{messages,[]}
(foo@REDACTED)104> % send duplicate messages from Erlang
(foo@REDACTED)104> process_info(self(), messages).
{messages,[{<5007.61.0>,hello},{<5007.61.0>,hello}]}
(foo@REDACTED)105> receive {P,X} -> {P,X} after 2000 -> false
end.
{<5007.61.0>,hello}
(foo@REDACTED)106> b().
P = <5007.61.0>
X = hello
ok
(foo@REDACTED)107> receive {P,X} -> {P,X} after 2000 -> false
end.
{<5007.61.0>,hello}
(foo@REDACTED)108> process_info(self(), messages).
{messages,[]}
(foo@REDACTED)109>
This works as expected. However, when I do the same but send the
messages from a Java program using JInterface the first message is
received but pattern matching for the second message seems to fail:
(foo@REDACTED)111> b().
ok
(foo@REDACTED)112> process_info(self(), messages).
{messages,[]}
(foo@REDACTED)113> % send duplicate messages from JInterface
(foo@REDACTED)113> process_info(self(), messages).
{messages,[{<4999.1.0>,hello},{<4999.1.0>,hello}]}
(foo@REDACTED)114> receive {P,X} -> {P,X} after 2000 -> false
end.
{<4999.1.0>,hello}
(foo@REDACTED)115> b().
P = <4999.1.0>
X = hello
ok
(foo@REDACTED)116> receive {P,X} -> {P,X} after 2000 -> false
end.
false
(foo@REDACTED)117> process_info(self(), messages).
{messages,[{<4999.1.0>,hello}]}
(foo@REDACTED)118>
The essentials of the Java program are:
OtpNode node = new OtpNode("jnode", "secretcookie");
OtpMbox mbox = node.createMbox("mbox1");
OtpErlangObject[] msg = new OtpErlangObject[2];
msg[0] = mbox.self();
msg[1] = new OtpErlangAtom("hello");
OtpErlangTuple tuple = new OtpErlangTuple(msg);
mbox.send("foobox", "foo@REDACTED", tuple);
erlang:system_info(version) = "5.5.1", R11B
Both clients on Windows Win2K, receiver (zippy) is Linux.
Any ideas or clues as to where to look or why this doesn't appear to work?
Happy New Year everyone 3|;-P
More information about the erlang-questions
mailing list