[erlang-questions] Text based protocols

Joern <>
Sat Apr 21 14:31:31 CEST 2007


Hello erlang-questions,

I am looking for an elegant solution for the parsing (and maybe the
creation) of text based packets. A packet consists out of a fixed size
header, a few magic characters and a payload of variable size.

At first I tried to utilize the binary syntax but as e.g. the length
indication in the header is encoded as a string I would have needed to
convert back and forth all the time which did not seem worth the
trouble. Parsing with io_lib:fread/2 works fine, but in case of errors
I do not get the information which match failed and why it failed.

Is there a suggestion how to handle the parsing of text based packets?


Joern
--



More information about the erlang-questions mailing list