Reputation: 33
I'm trying to establish a client-server connection using RPyC between 2 VM instances on google cloud. I have the following code:
SERVER side:
import rpyc
class MyService(rpyc.Service):
def on_connect(self):
# code that runs when a connection is created
# (to init the serivce, if needed)
pass
def on_disconnect(self):
# code that runs when the connection has already closed
# (to finalize the service, if needed)
pass
def exposed_get_answer(self): # this is an exposed method
return 42
def get_question(self): # while this method is not exposed
return "what is the airspeed velocity of an unladen swallow?"
if __name__ == "__main__":
from rpyc.utils.server import ThreadedServer
from rpyc.utils.authenticators import SSLAuthenticator
authenticator = SSLAuthenticator("myserver.key", "myserver.cert")
server = ThreadedServer(MyService, port=12345, authenticator=authenticator)
server.start()
CLIENT side:
import rpyc
conn = rpyc.ssl_connect("myserver", port = 12345, keyfile=None,
certfile=None)
conn.execute("print ('world')")
When i run Client.py i get the following error
socket.gaierror: [Errno -3] Temporary failure in name resolution
I think that has something to do with the keyfile and certfile, but i'm not sure how to set them. Any ideas? Thank you!
Upvotes: 1
Views: 1086
Reputation: 4196
GAIERROR : Get Address Info Error
This error comes when the name resolution fails.
Either add entry in /etc/hosts
file if both machines are Linux
OR replace "myserver" with IP Address.
Upvotes: 1
Reputation: 666
Check if the name "myserver" is reachable, otherwise replace it by an IP address.
Upvotes: 0