Little-Endian Active Mode Tcp ?

Eric Newhuis enewhuis@REDACTED
Wed May 28 20:54:53 CEST 2003

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.

Eric Newhuis

More information about the erlang-questions mailing list