Starting an INDIVIDUAL instance of a subclass from asynchat
Question
So the situation I have is that I have loaded more than one class that I've made that subclasses from asynchat
, but I only want one of them to run. Of course, this doesn't work out when I call asyncore.loop()
as they all begin. Is there any way to make only one of them begin running?
edit: I think it has something to do with the map
parameter that can be passed to asyncore.loop
but I can't get it working.
edit2: I got it. Basically I did the following:
asyncore.loop(map=my_instance._map)
Solution
For all who were curious, I figured it out. If you pass your instance's _map
to loop()
it seems to only start the single instance.
Example:
my_asyncore_obj = SomeAsyncoreObj()
asyncore.loop(map=my_asyncore_obj._map)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow