Decoding Erlang Messages Sent Over TCP With EI

John Koenig koenigjm@REDACTED
Sun Jan 2 20:29:21 CET 2011


I am currently porting a server process (written in C) to ei, which used to interact with an erlang process via the older erl_interface.  I am able to get the the two sides talking over a localhost TCP socket, but I am having trouble decoding the tuples sent to the C based server.  

Tuples are being sent from an interactive erlang session as follows:

{any, mynode@REDACTED} ! {tuple1, typle2, []}

When the message is received in the C based server via ei_receive,  however, ei_decode_tuple_header returns non-zero and I am unable to proceed further.  Calling ei_get_type on the buffer results in 'p' which, according to ei.h, corresponds to ERL_NEW_FUN_EXT.  Why is this failing and why is this tuple being reported as an ERL_NEW_FUN_EXT?

The only example I have seen thus far (http://www.trapexit.org/How_to_use_ei_to_marshal_binary_terms_in_port_programs) uses ei stdin/stdout, can ei be used over a TCP socket at all?  

Thanks in advance,

John


More information about the erlang-questions mailing list