TCP/IP Stream and recv?

Per Hedeland hedeland@REDACTED
Wed Feb 8 22:47:24 CET 2006


Chris Campbell <cyberdanx@REDACTED> wrote:
>
>I see, thanks.  This implies if the client is in erlang, it's ok to
>use {packet, 4} but if the client is in another language you need to
>do as you suggest and implement a scheme for identifying starts/ends
>of messages in the stream or use the packaging format the OTP uses.

Yes, I guess that's about right - assuming that you *want* to preserve
message boundaries, of course. And if you do, and can't trivially
determine them from the messages themselves, {packet, N} is probably the
most obvious and trivial thing to implement in any other language too.
And if both ends are Erlang, you could perhaps just use Erlang
distribution instead, and just forget all about these worries...

>Is it possible to instruct the system on the format of messages so
>that recv will pull a single message in a customised format?

Not that I know of.

> I just
>noticed the header option, is this what that is for?

No, it doesn't affect how much is pulled, only the form it is delivered
in. (And I guess it's pretty much obsoleted by the Bit Syntax.)

--Per Hedeland



More information about the erlang-questions mailing list