Little-Endian Active Mode Tcp ?

peter@REDACTED peter@REDACTED
Thu May 29 10:39:25 CEST 2003


Yeah, I have tried it out too, but I am having another problem.

The Erlang 4 byte packet header is a count on the REMAINING part
of the package. In the SMPP protocol (SMS stuff), the 4 byte length
value should be the length of the REMAINING part + the 4 byte header
size. (the value defined in SMPP is thus differing by 4 from the
value in Erlang/OTP).

Is there any way to change the counting in the gen_tcp module?

Peter

> O most knowledgable ones,
>
> The active-mode {packet, 4} socket is AMAZING.  This is what one needs.
>   Beautiful.  But...
>
> I'd love to get rid of the binary continuation fragments in my
> recursive  feed parsers.  I could do it if Erlang would parse the
> little-endian  header.  My messages originate from an Intel box and the
> 4-byte size  header is little-endian.  I want Erlang to handle those
> headers so I can  simplify my parser code to focus on the message
> content instead of  content + framing.
>
> 1. Is there a way to do this without hacking the Erlang source?
> 2. If not then is there a way to do this by hacking the Erlang source?
> 3. Or maybe there is a parser pattern/behavior/template that I should
> use that has a simple "callback" or message-passing model that gives me
>  what I want?
> 4. Or is there a way to install a specific protocol handler.  I see the
>  asn stuff and wonder.
>
> Suggestion:  Perhaps a {packet, -2} or {packet, -4} for little-endian
> packet headers would round-out the built-in active socket logic.
>
> Sincerely,
> Eric Newhuis






More information about the erlang-questions mailing list