[erlang-questions] One more question?
Michael
erlangy@REDACTED
Fri Feb 12 21:32:06 CET 2010
On Fri, Feb 12, 2010 at 03:03:02PM -0500, 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
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Also see Programming Examples in docs.
This should work if you can be assured that the first 4 bytes
are always before the message.
1> <<Bytes:4/binary, Msg/binary>> = <<0,0,0,10,72,101,108,108,111,46,46>>.
2> Msg.
<<"Hello..">>
3>
--
Michael McDaniel
Portland, Oregon, USA
http://trip.autosys.us
http://putitgetit.com
More information about the erlang-questions
mailing list