PYRO4 - Errno 10061连接被拒绝 [英] PYRO4 - Errno 10061 connection refused

查看:378
本文介绍了PYRO4 - Errno 10061连接被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用PYRO4和Python 2.7将客户端计算机连接到不同网络中的服务器mashine



我的服务器代码是:

  import Pyro4 

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

daemon = Pyro4.Daemon(port = 9999,nathost =78.149.XX,natport = 5555)
uri = daemon.register(Thing(),gameServer )#register Thing()as Pyro object
printReady。Object uri =,uri
daemon.requestLoop()

,客户代码为:

  import Pyro4 

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

但是,当我运行服务器,我得到这个错误:

  CommunicationError:can not连接:[Errno 10061]无法建立连接,因为目标机器主动拒绝它

因为8小时来解决这个问题,但似乎它不会永远固定。如果任何人知道解决方案,请帮助我。



注意:
1.我是在路由器后面的服务器,所以我口令5555到我的私有IP地址。


  1. 我关闭了防火墙和防病毒软件。 //pythonhosted.org/Pyro4/tipstricks.html#failed-to-locate-the-nameserver-connection-refused-what-nowrel =nofollow>手动?



    您的守护进程根本不能访问您认为它的地址。也许你需要添加一个适当的绑定主机到守护程序构造函数调用,将其绑定在可从外部访问的网络接口上。



    同时尝试逐一消除可能的原因,看看哪一个是罪魁祸首。例如,您是否尝试在没有路由器的情况下运行它?


    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.

    解决方案

    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?

    这篇关于PYRO4 - Errno 10061连接被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆