Itamar, I agree. After reading Adi Roiban's proposed solution I think
it is the correct way to handle such scenarios.
Regards,
Miha.
On Sun, Dec 9, 2012 at 1:57 PM, Itamar Turner-Trauring
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 object:
port = reactor.listenTCP(....) port.stopReading()
And start again by calling startReading().
However: - 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 listenTCP. - After hitting the limit, clients will get connection refused, IIRC.
In general it's better to do a protocol-level solution, as Adi Roiban suggested.
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python