[erlang-questions] Badarg error
Farruco Sanjurjo
madtrick@REDACTED
Tue May 8 09:06:36 CEST 2012
Hi,
I'm getting a badarg error in this code
from_binary(Data = <<Head:8, 0:1, PayloadLen:7, Trailing/bits>>, Acc) ->
PayloadBytes= case PayloadLen of
126 ->
<<ExtPayloadLen:16, _/binary>> = Trailing,
2 + ExtPayloadLen;
127 ->
<<ExtPayloadLen:64, _/binary>> = Trailing,
8 + ExtPayloadLen;
_ ->
%<<Payload:ExtPayloadLen/binary, Rest/binary>>
PayloadLen
end,
FrameSize = 16 + (PayloadBytes * 8),
<<Frame:FrameSize, Rest/binary>> = Data,
from_binary(Rest, [decode_frame(<<Frame/binary>>) | Acc]);
The error points to the line " FrameSize = 16 + (PayloadBytes * 8)".
I've been struggling for a while but I can't figure out what's wrong. Any
suggestion?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120508/738b88d8/attachment.htm>
More information about the erlang-questions
mailing list