[Twisted-Python] Limiting the number of connections

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


On 9 December 2012 15:23, Itamar Turner-Trauring <itamar at itamarst.org> wrote:
> 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.

Many thanks! That answered my question.

-- 
Adi Roiban



More information about the Twisted-Python mailing list