[Twisted-Python] Limiting the number of connections

Adi Roiban adi at roiban.ro
Sun Dec 9 08:14:54 EST 2012

On 9 December 2012 14:57, 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
> object:
> port = reactor.listenTCP(....)
> port.stopReading()
> And start again by calling startReading().

Many thanks for you explanation.

Checking the documentation I can read that reactor.listenTCP returns
an IListeningPort [1]
Checking IListeningPort I can read that it has no stopReading() ,
startReading() methods [2]

Can you please advise how and when to use startReading vs startListening ?

Many thanks!

[1] http://twistedmatrix.com/documents/12.2.0/api/twisted.internet.interfaces.IReactorTCP.html#listenTCP
[2] http://twistedmatrix.com/documents/12.2.0/api/twisted.internet.interfaces.IListeningPort.html

Adi Roiban

More information about the Twisted-Python mailing list