[erlang-questions] Two confusions??

Jachym Holecek freza@REDACTED
Wed Feb 10 19:11:21 CET 2010


# Ish Rattan 2010-02-10:
> 1. In socket based erlang code I have seen tcp-options of the form:
>
>    [binary, {packet, 0}, ..]
>    [binary, {packet, 4}, ..]
>
> what is the difference between the two?

These affect application-level framing on the TCP stream. Zero gives raw stream (no framing),
four prepends each packet (== single invocation of gen_tcp:send/2 on either side of the pipe)
with a four-byte big-endian header encoding payload length. See also inet(3) manpage.

The rest of your question needs some more context (depends on which of the above options
you use and what is it that you're trying to achieve).

Regards,
	-- Jachym


More information about the erlang-questions mailing list