PYRO4 - Errno 10061 connection refused

前提是你 提交于 2019-12-11 11:25:06

问题


I am trying to connect a client machine to a server mashine in different network using PYRO4 and Python 2.7

My server code is:

import Pyro4

class Thing(object):
    def method(self, arg):
        return arg*2

daemon=Pyro4.Daemon(port=9999,nathost="78.149.X.X", natport=5555)
uri=daemon.register(Thing(),"gameServer")  # register Thing() as a Pyro object
print "Ready. Object uri =", uri
daemon.requestLoop()

and the client code is:

import Pyro4

server = Pyro4.Proxy("PYRO:gameServer@78.149.X.X:5555")
print server.method(6)

However, when I ran the server, I got this error:

CommunicationError: cannot connect: [Errno 10061] No connection could be made because the target machine actively refused it

I am searching since 8 hours to fix this issue but it seems it will not be fixed forever. Please if anybody know the solution please help me.

NOTE: 1. I am rannig the server behind a router, so I forworded the port 5555 to my private IP address. Also, I tested the port by an online service and its opend correctly.

  1. I closed the firewall and the antivirus software.

回答1:


Have you tried all the suggestions mentioned in the manual?

Your daemon simply is not accessible on the address that you think it is. Perhaps you need to add an appropriate binding host to the daemon constructor call, to bind it on the network interface that is accessible from the outside.

Also try to eliminate possible causes one by one and see which one is the culprit. For instance, have you tried to run it without the router in between?



来源:https://stackoverflow.com/questions/31372515/pyro4-errno-10061-connection-refused

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!