I'm currently trying to switch from asyncoreto asyncio, since I am porting some old code from python 27 to python 35 . But I am not very familiar with both.
Here is a concise version of the problematic part:
import socket
import asyncore
mapDict = {}
fc = FeedbackController(port)
fc.start()
class FeedbackController(object):
def __init__(self, port=None):
self.ipcchannel = IPCConnectionHandler(self, theMap=mapDict)
self.udpconnectionhandler = UDPDispatcher(self, theMap=mapDict)
def start(self):
asyncore.loop(timeout=60.0,map=theMap)
…
class UDPDispatcher(asyncore.dispatcher):
def __init__(self, theMap):
asyncore.dispatcher.__init__(self, map=theMap)
self.create_socket(socket.AF_INET, socket.SOCK_DGRAM)
self.bind((LOCALHOST, FC_PORT))
class IPCConnectionHandler(asyncore.dispatcher):
def __init__(self,theMap=None):
asyncore.dispatcher.__init__(self, map=theMap)
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.bind((LOCALHOST, IPC_PORT))
self.listen(5)
I'm currently running on a Macos Sierra and it crashes when asyncore.loopcalled
Any help on how to go would be great
source
share