[erlang-questions] (how) Can a tcp socket get "overloaded"?
Scott Lystig Fritchie
fritchie@REDACTED
Tue Jun 24 22:31:21 CEST 2008
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
More information about the erlang-questions
mailing list