[erlang-questions] Text based protocols

Joe Armstrong <>
Sun Apr 22 11:43:05 CEST 2007


The fact that your packets are text based is irrelevant.

The thing of interest is the grammar that you wish to parse.

Tell us the grammar and we can try to help.

/Joe


On 4/21/07, Joern <> wrote:
> 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
> --
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list