[Twisted-Python] Limiting the number of connections
miha.valencic at gmail.com
Sun Dec 9 08:07:27 EST 2012
Itamar, I agree. After reading Adi Roiban's proposed solution I think
it is the correct way to handle such scenarios.
On Sun, Dec 9, 2012 at 1:57 PM, Itamar Turner-Trauring
<itamar at itamarst.org> wrote:
> On 12/09/2012 05:31 AM, Miha Valencic wrote:
>> No, the server shouldn't accept() the socket after n connections are
>> opened(). But see previous paragraph.
> You can stop accept()ing by calling stopReading() on the returned port
> port = reactor.listenTCP(....)
> And start again by calling startReading().
> - When you are accept()ing, it will accept() a few at a time.
> - Even if you stop accept()ing, the OS will still do TCP handshakes,
> approximately up to a limit determined by one of the arguments passed to
> - After hitting the limit, clients will get connection refused, IIRC.
> In general it's better to do a protocol-level solution, as Adi Roiban
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
More information about the Twisted-Python