[erlang-questions] gen_tcp nonblocking send

Igor Ribeiro Sucupira igorrs@REDACTED
Thu May 1 02:11:49 CEST 2008


I don't think that is possible.
Once you've sent data, there's no way to "unsend" it. If a timeout
occurs, you never know how much of the data the receiver has got.

Can't you close the socket and reconnect everytime you have a timeout?

Igor.

On Wed, Apr 30, 2008 at 6:38 PM, Daniel Ginsburg <dg@REDACTED> wrote:
>
> Is there any way to make gen_tcp:send operate in non-blocking mode?
>
>  As I read the documentation, there are two possible ways to handle
>  stalling reader:
>  1) block forever
>  2) use {send_timeout, N} and when timeout occurs, close the socket.
>
>  In my application 2 is unacceptable and 1 is suboptimal.
>
>  What I'd really like to have is an opportunity to know that kernel send
>  buffer is filled and send would block, and conversely, when stalled
>  receiver has recovered and I can send more data. It that possible with
>  standard erlang library? I'd really hate to write my own driver to
>  handle this.



More information about the erlang-questions mailing list