I have two machines using python rpyc
,one is server(ip:10.0.3.120)
, another is client(ip:10.0.3.197). The code shows below:
Server (ip:10.0.3.120)
from rpyc import Service
from rpyc.utils.server import ThreadedServer
class TestService(Service):
def exposed_test(self, num):
return num + 1
sr = ThreadedServer(TestService, port=9999, auto_register=False)
sr.start()
Client (ip:10.0.3.129)
import rpyc
conn = rpyc.connect('10.0.3.120', 9999)
cResult = conn.root.test(11)
conn.close()
print cResult
Client shows this error when I run server
and client
:
Traceback (most recent call last):
File "rpyc_client.py", line 4, in <module>
conn = rpyc.connect('10.0.3.120', 9999)
File "/usr/local/lib/python2.7/site-packages/rpyc-3.2.3-py2.7.egg/rpyc/utils/factory.py", line 89, in connect
s = SocketStream.connect(host, port, ipv6 = ipv6)
File "/usr/local/lib/python2.7/site-packages/rpyc-3.2.3-py2.7.egg/rpyc/core/stream.py", line 114, in connect
return cls(cls._connect(host, port, **kwargs))
File "/usr/local/lib/python2.7/site-packages/rpyc-3.2.3-py2.7.egg/rpyc/core/stream.py", line 92, in _connect
s.connect((host, port))
File "/usr/local/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
How does connect
method use? If I use public network IP to build a rpyc
server, could I connect it at home ?? Thanks a lot!
--
---
You received this message because you are subscribed to the Google Groups "rpyc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rpyc+uns...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.