[erlang-questions] (how) Can a tcp socket get "overloaded"?

Nicholas Schultz-Møller <>
Tue Jun 24 16:24:45 CEST 2008


I am using tcp sockets in a distributed system and I have run into a strange
error (or perhaps I'm using sockets the wrong way):

I am trying to send small binary packets across the socket with small
intervals in between. The binary packets are Erlang terms marshalled with
term_to_binary/1. The problem is that sometimes only some of the packets
arrive in the other end even though gen_tcp:send/2 returns 'ok' for all
packets. I have tried setting all kinds of properties for the sockets e.g.
'nodelay', {sndbuf, 0}, {recbuf, 0} but the only thing that works is if I
"sleep" (timer:sleep/1) 1 millisec between each gen_tcp_send/2 call.
The error occurs both in Windows XP and in Linux and when running the system
on a network or on localhost.
I know that gen_tcp:send/2 returns ok even though the socket in the other
end is closed, but I have checked and it isn't closed.

Can the sockets get overloaded? Not that I have ever heard about that... Or
is it a buffer problem?

What am I doing wrong? (Sorry for not providing any code, but it is
difficult to extract a useful snippet.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080624/684361d7/attachment.html>

More information about the erlang-questions mailing list