Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
-define(PROTO, 16#0a). % only interested in protocol version 10
parse_content(_Args,
<<
?PROTO:8, % protocol version
Rest/binary
>>) ->
case find_null(Rest, 1) of
error ->
{{error, up}, unexpected_data};
{Version, _Bin} ->
{{ok, result}, [binary_to_list(Version)]}
end;
parse_content(_Args, _) ->
{{error, up}, unexpected_data}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment