[erlang-questions] gen_tcp send non-blocking in erlang?

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Mon Mar 17 11:49:11 CET 2014


On Mon, Mar 17, 2014 at 8:15 AM, Vinoth Kumar <vinothsparrow@REDACTED>wrote:

> Does gen_tcp supports non-blocking send ?
>
> I have tried gen_tcp:send which returns the ok while the packets has not
> been sent to the receiver. Whether any mechanism in erlang to check the
> sent message delivary?
>

I think you must consider you may be going in a direction which TCP does
not support, in general. The danger is you end up in a situation where you
are bending the rules of TCP to a point where the guarantee you expect is
not even there. Only turmoil is on this path.

The problem is Erlang can only see so far. Once it delivers data to the
kernel, the kernel is in control of what happens and you have relatively
few ways to ask the kernel what it is doing. Worse, even if the kernel
manages to send data, the NIC might queue you. Modern NICs have buffers in
the excess of 4096 packets. And you have even fewer ways to ask those about
their state. And if the NIC manages to send data, the hops in route might
queue you.


-- 
J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140317/2b6c1322/attachment.htm>


More information about the erlang-questions mailing list