Pyro5 : how to connect between different machines

162 views Asked by At

I am a student who is trying to pass a requirement. I only knew python and pyro5 because of this requirement.

I have a code from https://github.com/irmen/Pyro5/tree/master/examples/chatbox which is the sample documentation for pyro5. I was able to make it run on a virtual machine (both server.py and client.py) and it is running perfectly.

Now I am trying to make it work between 3 different machines. Server, Client1 and Client 2.

My understanding is that I need to make sure that the server where the client.py file is the same as the ip hosting the server.py.

Server.py code for daemon set-up is as follows : enter image description here

**Note **: I am running pyro5-ns in one of my terminals for the server.

Client.py has enter image description here

**The error : **But I am getting "Pyro5.errors.CommunicationError: cannot connect to ('localhost', 9090): [Errno 111] Connection refused"... "Failed to locate the nameserver") from x Pyro5.errors.NamingError: Failed to locate the nameserver

Am I missing a step here? To reiterate this code runs if server.py and client.py both run on the same machine. My goal is to let 3 or machine to chat.

Is it possible to use Pyro5.Daemon.serveSimple which I got from this thread but its for Pyro4 (Pyro4: Failed to locate the nameserver)? I am not sure how to configure the code though.

Any help will be appreciated.

1

There are 1 answers

0
Diwani Hime On

I managed to figure this out by trial and error.

  1. Assigned the ip to the named instance of the server by using pyro5-ns -n ,

  2. then changing namedserver parameter to ns.register(, uri)

  3. then changing the proxy parameters of the client code from PYRO:PYRONAME to PYRO:PYRO.namedinstance:port.