Question

I've came up with problem regarding unregistering protocols from reactor in twisted while application is running.

I use hardware modems connected to PC by USB and that's why this scenario is so important for my solution. Has anyone an idea how to do it?

Greets, Chris

Was it helpful?

Solution

When you first call reactor.listen on your protocol factory, it returns an object that implements IListeningPort, see http://twistedmatrix.com/documents/8.2.0/api/twisted.internet.interfaces.IListeningPort.html -- just save that object somewhere and when you want to stop listening on that protocol factori, call that object's stopListening method.

I assume that reactor.listen on the protocol factory is what you implicitly mean by "registering" a protocol (which logically should be what you're trying to undo by "unregistering" it), if you mean something else please clarify exactly how you "register a protocol" and we'll work out how to undo that!-)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top