[erlang-questions] (how) Can a tcp socket get "overloaded"?
Nicholas Schultz-Møller
nicholassm@REDACTED
Wed Jun 25 00:17:58 CEST 2008
Hi Scott,
Thanks - yeah you're right. I forgot to set the 'packet' property which
results in Erlang handling any fragmentation and reassembling logical
packets (application specific units of data) in the other end.
/Nicholas
2008/6/24 Scott Lystig Fritchie <fritchie@REDACTED>:
> Nicholas, are you assuming that if you use:
>
> %% Client side
> Size0 = size(Bin),
> gen_tcp:send(Socket, Bin),
>
> And:
>
> %% Server side
> {ok, Bin1} = gen_tcp:recv(ConnectedSocket, 0),
> Size1 = size(Bin1),
> %% or perhaps we're using active mode?
> Size2 = receive
> {tcp, ConnectedSocket, B} -> size(B)
> end,
>
> ... that Size0 is exactly equal to Size1 or Size2? If yes, then you're
> mis-using TCP, because TCP communication is a pure byte steam and does
> not have a notion of message boundaries. Any delays on the sender's
> side to try to keep hunks-of-the-stream's-bytes separate will eventually
> fail when the sender's load increases, or if the OS on either side feels
> like rebuffering, or when the network in the middle drops a packet and a
> retransmission juggles the receiver's buffering efforts, or ...
>
> -Scott
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080625/1b0fa2d4/attachment.htm>
More information about the erlang-questions
mailing list