[erlang-questions] Receiving identical messages from Erlang and from JInterface

Richard Carlsson richardc@REDACTED
Thu Jan 4 20:18:25 CET 2007


Hubert Matthews wrote:
> Richard Carlsson wrote:
>> Try using different variable names in the second receive, e.g. {P1,X1}.
> 
> Doing that works fine.  What I'm trying to understand is why seemingly
> identical terms sent from an Erlang client match but when sent from Java
> don't match.  If they were incorrectly sent by Java then why are they
> displayed correctly in the process' message queue?

There seems to be a difference in the bit representation, which is for
some reason not visible in the displayed form <4999.1.0>.

> P == P1 gives false, as does P =:= P1.
> 
> (foo@REDACTED)60> term_to_binary(P).
> <<131,103,100,0,11,106,110,111,100,101,64,106,117,109,98,111,0,0,0,1,0,0,0,0,3>>
> 
> (foo@REDACTED)61> term_to_binary(P1).
> <<131,103,100,0,11,106,110,111,100,101,64,106,117,109,98,111,0,0,0,1,0,0,0,0,1>>
> 
> The last byte is different: 3 then 1.
> 
> When sent from Erlang I get something completely different:
> 
> (foo@REDACTED)68> term_to_binary(PE).
> <<131,103,100,0,24,119,105,98,98,108,101,64,106,117,109,98,111,46,111,120,121,119,97,114,101,46,110,101,116,...>>

I expect that there is someone out there on the list with more knowledge
about pid encodings and Jinterface who can see what the problem is.

	/Richard



More information about the erlang-questions mailing list