erl_interface and buffer overruns
Sun Aug 27 01:51:24 CEST 2006
On 8/26/06, Joel Reymont <> wrote:
> What is not clear is whether you can retry receiving the message if
> the buffer is too small or the message is lost on error. Any idea?
hmm... from reading the code i don't think erl_receive_msg() can
return EMSGSIZE since it passes in a resizable ei_x_buff to the lower
level ei_do_recv_msg() function. if the user supplied buffer is too
small, it will only contain a truncated copy of the received data, but
the ErlMessage parameter will contain the complete decoded message.
erl_xreceive_msg() will grow the user supplied buffer if necessary, in
addition to decoding it.
in any case, i think erl_interface was deprecated a few releases ago?
you probably want to use ei_receive_msg() or ei_xreceive_msg(). the
former returns EMSGSIZE if the buffer is too small and discards the
message; the latter grows the buffer if necessary.
More information about the erlang-questions