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.