Maybe there is a BIF that is returning the remaining no of connections with respect to that backlog atom...<br><br><div class="gmail_quote">On Tue, May 26, 2009 at 10:11 PM, Jarrod Roberson <span dir="ltr"><<a href="mailto:jarrod@vertigrated.com">jarrod@vertigrated.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">On Tue, May 26, 2009 at 1:20 PM, Alin Popa <<a href="mailto:alin.popa@gmail.com">alin.popa@gmail.com</a>> wrote:<br>

> Hi Jarrod,<br>
><br>
> Something like this might help you:<br>
><br>
> -define(MAX_TCP_CONNECTIONS, 1000).<br>
> -define(TCP_OPTIONS, [binary, {packet, 0}, {active, false}, {reuseaddr,<br>
> true}, {backlog, ?MAX_TCP_CONNECTIONS}]).<br>
><br>
> listen(Port, F) -><br>
>      {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),<br>
>      accept(LSocket, F).<br>
><br>
> .............<br>
><br>
> Hope this is what you are looking for ...<br>
<br>
</div>This will do what I asked about but it doesn't do what I was<br>
"thinking' about :-)<br>
<br>
What I really want to be able to do is accept the connection and if<br>
max connections is exceeded send a message to the client that the<br>
server is overloaded and the close the connection. What I really can't<br>
figure out is how to pass around  a "current connection count" to I<br>
can increment it and decrement it during accepts and disconnects.<br>
<div><div></div><div class="h5">_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br><br>Alin<br><br>