Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
parse_header(Args,
<<
Pldlen:24/little, % 3 bytes payload length
_:8, % 1 byte sequence id or packet nb
Pld/binary % content
>>) ->
case byte_size(Pld) == Pldlen of
true ->
parse_content(Args, Pld);
false ->
{{error, up}, unexpected_data}
end;
parse_header(Args, _) ->
{{error, up}, unexpected_data}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment