tcp_close during async accept

Joel Reymont joelr1@REDACTED
Mon Jul 6 18:20:30 CEST 2009

I'm playing with Serge's "Non-blocking TCP server using OTP  
principles" [1]. When spawning a large number of connections almost at  
once, I'm seeing tcp_close messages on the client end, even before  
seeing inet_async on the client end.

I may spawn 700 client connections and only half may go through, even  
though my backlog option is 1024, e.g.

     Opts = [binary,
             {packet, 0},
             {reuseaddr, true},
             {keepalive, true},
             {backlog, 1024},
             {active, false}],
     case gen_tcp:listen(Port, Opts) of
         {ok, Socket} ->
             %% Create first accepting process
             {ok, Ref} = prim_inet:async_accept(Socket, -1),

Any suggestions on what's going on?

Is it kosher to use prim_inet:async_accept/2?

Am I using backlog correctly?

	Thanks, Joel


Mac hacker with a performance bent

More information about the erlang-questions mailing list