[erlang-questions] gen_tcp question

Sean Hinde <>
Thu Sep 14 14:21:30 CEST 2006


Hi Joe,

I have used this technique with really quite large packets and it  
always seemed to do the right thing.

I typically use {packet, 2} so that the other end cannot fill up my  
machine with DoS style packets.

Sean


On 14 Sep 2006, at 12:35, Joe Armstrong ((TN/EAB)) wrote:

>
> I have a question about gen_tcp
>
> A client does this:
>
> 	{ok, Port} = gen_tcp:connect(Host, Post, [binary,{packet,N}])
> 	get_tcp:send(Port, <<Bin>>)
> 	
> The server
>
> 	calls gen_tcp:listen(Port, [binary,{packet,N}])
>
> Then goes into a receive loop to receive messages
>
> Questions:
>
>      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?)
>
> The behaviour appears not to be documented
>
> /Joe
>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list