[Twisted-Python] i want to update 1000 devices running as servers

Itamar Turner-Trauring itamar at itamarst.org
Fri Jul 20 10:26:51 EDT 2012

On 07/20/2012 04:26 AM, Luka Rahne wrote:
> for each line in sx:
>      encode line whit extra data in packet (packet is like len + encrypted_)
>      Send packet over UDP (tcp not supported)
>      wait for ACK ("OK" packet in my example)
>      wait for 0.05 s (not in included example)
> I done some code that should support this and i have tried to stop
> protocol but calling self.doStop()  function
> (twisted.internet.protocol.AbstractDatagramProtocol)    raises assert
> assert self.numPorts > 0
> I was hoping that this function will remove protocol instance from reactor.

You can do:

port = reactor.listenUDP(....)
port.stopListening() # disconnect port

More information about the Twisted-Python mailing list