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' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -