[erlang-questions] Decoding Erlang Messages Sent Over TCP With EI

Steve Vinoski <>
Sun Jan 2 21:46:51 CET 2011

On Sun, Jan 2, 2011 at 3:05 PM, John Koenig <> wrote:
> Code is attached.
> What you have said so far has brought me close of identifying the problem.  Up until now I
> have assumed that ei_decode_tuple_header would scan me ahead to the proper location, but I
> starting to think I was wrong to do so.  Especially after looking at the received data more
> closely in gdb.
> How does one know the proper offset from which to start decoding the actual message?

You start at offset 0 and the decode functions update the "index"
variable you pass to them.

Are you getting a version number on your message? You probably have to
call ei_decode_version first to take the version number off the
message. After that, I think the rest of your code will work.


More information about the erlang-questions mailing list