[erlang-questions] gen_tcp question

Vlad Dumitrescu <>
Thu Sep 14 14:08:37 CEST 2006

On 9/14/06, Joe Armstrong (TN/EAB) <> wrote:
>     1) is <<Bin>> delivered as a single message to the server program?
>        or is the packet fragmented.
>     2) Does fragmentation or not depend upon N (the packet size)
>         must N be > 0 for the receiver to be able to reconstruct the
>         fragments (if fragmented?)


I think the behaviour isn't documented because it isn't dictated by
Erlang, but is dictated by the TCP parameters of the socket. Any TCP
packet may be fragmented (it certainly is if it is larger then the
current MTU), but I think that even servers along the way (if it's a
remote connection) may further fragment it.

So to be sure, assume it's fragmented.

If N=0 you will have to have your own way to be to reconstruct each
message from the TCP stream. Relying on each message to be delivered
separately isn't working. I know from personal experience :-)

best regards,

More information about the erlang-questions mailing list