[erlang-questions] gen_tcp nonblocking send

Daniel Ginsburg <>
Wed Apr 30 23:38:05 CEST 2008

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