TCP/IP Stream and recv?

Chris Campbell cyberdanx@REDACTED
Wed Feb 8 20:44:50 CET 2006

On 08/02/06, Per Hedeland <hedeland@REDACTED> wrote:

> Generally correct, but... - what did you think that "{packet, 4}" option
> did?:-)

I confess it didn't register what packets meant at that level.  I was
thinking lower level, but it's tcp not ip.

> If you don't use any of the packet options, it behaves just like TCP -
> there are no messages, only a byte stream, and your recv could get
> anything from 1 byte out of the first message to both messages complete.

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.

Is it possible to instruct the system on the format of messages so
that recv will pull a single message in a customised format?  I just
noticed the header option, is this what that is for?  It doesn't
really matter if we can't; another level of indirection will solve
this anyway.

Thanks again,

More information about the erlang-questions mailing list