[erlang-questions] gen_tcp:send(Sock, SmallPacket) issue

Matthias Lang <>
Tue Jun 19 11:14:07 CEST 2007


 writes:

 > I noticed that, when I use gen_tcp:send to send a small packet from
 > one machine to another, gen_tcp:send immediately returns ok, even when
 > the connection between the two machines is gone.

The TCP protocol does not guarantee that a call to 'send' will block
until your data has actually arrived at the other end.

..oh wait, here comes my radiation-hardened helper monkey! He's just
climbed up from the catacombs with a rusty binder of DOD standards
from 1979. Leafing through the mouldering pages, I find:

     For instance, SENDs might return immediate local acknowledgment,
     even if the segment sent had not been acknowledged by the distant
     TCP.

     http://www.networksorcery.com/enp/ien/ien124.txt

If you want different behaviour, you need to build it on top of TCP,
one way would be as Christian suggested.

Matthias



More information about the erlang-questions mailing list