[Twisted-Python] Transfering a transport between DatagramProtocols
Olivier Parisy
olivier.parisy at free.fr
Tue Nov 24 14:26:19 MST 2009
I am implementing a protocol where a DatagramProtocol "handshaking"
subclass get an arbitrary port (by calling "self.udpPort =
reactor.listenUDP(0, self)") and communicate it to a remote host.
Once this is done, I would like to "switch" to another DatagramProtocol
which would use the same port. To avoid a race condition, I would like
to "transfert" self.transport from the first DatagramProtocol to the
second without calling self.udpPort.stopListening().
Is this the "twisted" way to analyse this? Or should I use some kind of
"proxy" DatagramProtocol which would relay datagramReceived calls to the
proper DatagramProtocol, depending on the current protocol state
(handshaking or data exchange)?
Regards.
More information about the Twisted-Python
mailing list