sockets - How can I use asyncore with the multiprocessing IPC module in Python 3? -


i'm trying utilise client/server architecture of multiprocessing module facilitate communication between python scripts. want able implement separate connection listener apart main event loop, using asyncore. how can this?

while there no outward documentation of how so, i've tried construct basic asyncore.dispatcher using listener socket multiprocessing.listener:

import asyncore import socket multiprocessing.connection import listener, client  class connectionlistener(asyncore.dispatcher):     def __init__(self, ln):         asyncore.dispatcher.__init__(self)         self.set_socket(ln._listener._socket)     def handle_accepted(self, sock, addr):         print("accepted client!")  if __name__ == "__main__":     address = ('localhost', 19378)     try:         ln = listener(address)         x = connectionlistener(ln)         while true:             asyncore.loop()     except socket.error:         c = client(address)         print("client trying connect") 

while server loop, never fires handle_accepted.

i think method are looking handle_accept, not handle_accepted.


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -