[Twisted-Python] Limiting the number of connections

Itamar Turner-Trauring itamar at itamarst.org
Sun Dec 9 08:23:29 EST 2012

On 12/09/2012 08:14 AM, Adi Roiban wrote:
> 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 ?
A port object is also typically a IReadWriteFileDescriptor or whatever 
the interface is, though perhaps not on IOCP, or some other hypothetical 
future reactor. startListening() does the opposite of stopListening(), 
it's completely different than stop/startReading - the former pair are 
permanent 'open or close the socket', vs. the latter 'unregister socket 
from event loop temporarily'.

In any case, as I said, doing stopReading() on a TCP port is not 
particularly useful, much better to handle it in factory and protocol level.

More information about the Twisted-Python mailing list