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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -