Hi,<br><br>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):<br><br>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.<br>

The error occurs both in Windows XP and in Linux and when running the system on a network or on localhost.<br><div><div><div><div><div>
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.<br><br>Can the sockets get overloaded? Not that I have ever heard about that... Or is it a buffer problem?<br>

<br>What am I doing wrong? (Sorry for not providing any code, but it is difficult to extract a useful snippet.)<br></div></div></div></div></div>