I wanted to communicate between processes (one process does something, sends results to other process which does something with it). So I used this code:
Server:
from multiprocessing.connection import Listener
address = ('localhost', 6000) # family is deduced to be 'AF_INET'
listener = Listener(address, authkey='secret password')
conn = listener.accept()
print 'connection accepted from', listener.last_accepted
while True:
msg = conn.recv()
# do something with msg
if msg == 'close':
conn.close()
break
listener.close()
Client:
from multiprocessing.connection import Client
address = ('localhost', 6000)
conn = Client(address, authkey='secret password')
conn.send('close')
conn.close()
(source: interprocess communication in python)
And it works like a charm. But I wanted to run these two programs from another computer. On Comp. A I have these 2 programs. I connect to Comp A from Comp B by Wifi Lan (using ssh connection) and I run these 2 programs (which means they're running on Comp A), but they don't connect with each other. I've tried using wifi lan address (192.168.x.x) instead of "localhost" but it didn't work neither. What parameter do I have to use instead of "localhost" so that these 2 programs can connect. Or what is the easiest way to do this. Cheers!