[erlang-questions] One more question?

Jayson Vantuyl kagato@REDACTED
Sat Feb 13 06:10:19 CET 2010


If you receive it via a streaming port, you can also use {packet,4} as an option, which will automatically break the binaries into appropriate lengths.

Also, one of the more unusual (but awesome) bits of binary pattern matching is something like this:

> <<Bytes:32/integer, Chunk:Bytes/binary>>


Interestingly, you can also do it like this, to match chunks in a large binary:

> <<Bytes:32/integer, Chunk:Bytes/binary, Rest/binary>>


On Feb 12, 2010, at 12:03 PM, Ish Rattan wrote:

> 
> Erlang server gets message from non-Erlang client as:
> <<0,0,0,10,72,101,108,108,111,46,46>>
> (numeric 10 in 4-bytes followed by "hello..")
> 
> how to extract the pieces?
> 
> -ishwar
> 
> 
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
> 

-- 
Jayson Vantuyl
kagato@REDACTED



More information about the erlang-questions mailing list