[erlang-questions] gen_tcp nonblocking send

Igor Ribeiro Sucupira igorrs@REDACTED
Fri May 2 00:34:28 CEST 2008


On Thu, May 1, 2008 at 5:01 PM, Valentin Micic <valentin@REDACTED> wrote:
> >
>  > You didn't read my suggestion carefully enough - try again.
>  >
>
>  You're right -- I did not read it carefully enough. Your suggestion would
>  not develop a scheduling problem. However, after reading it again, I'm
>  really not sure why would O_NDEALY be such an evil thing, if it is
>  implemented as a separate function call (and not as a flag), that would
>  return a binary containing unsent octets. It would certainly help (in this
>  case not-so) intelligent queuing on the caller side -- unlike your sender
>  that needs to do pre-emptive queuing, until it receive's ack from "relay",
>  it would need to queue only unsent octets, right?


I don't really see the point of dealing with "partial sends" and
queuing unsent octets, if all you want is to send the whole message.
It doesn't look necessary in a concurrent environment with lightweight threads.

As for O_NDELAY, I still think it could be useful in some situation,
but not in this case, for a similar reason: you'll be sending the data
anyway, as soon as you can do it. So, why not just spawn a process to
do exactly that wait-and-send?

Igor.



More information about the erlang-questions mailing list