Errno 10061 : No connection could be made because the target machine actively refused it ( client - server )

后端 未结 14 650
無奈伤痛
無奈伤痛 2020-11-28 11:11

I have a problem with these client and server codes, I keep getting the [Errno 10061] No connection could be made because the target machine actively refused it

相关标签:
14条回答
  • 2020-11-28 11:20

    This could be because of proxy or firewall. If it's proxy, then you need to specify proxy setting at entry point of your code or project.

    import os #for proxy
    
    proxy = 'http://10.XX.XX.XX:8X8X' #your own proxy 'http://<user>:<pass>@<proxy>:<port>'
    
    os.environ['http_proxy'] = proxy 
    os.environ['HTTP_PROXY'] = proxy
    os.environ['https_proxy'] = proxy
    os.environ['HTTPS_PROXY'] = proxy
    #rest of code .....
    
    0 讨论(0)
  • 2020-11-28 11:23

    The solution is to use the same IP and Port number in both client and server. Try, in client to use TCP_IP = 'write the ip number here' TCP_PORT = writ the port number here s.connect((TCP_IP, TCP_PORT))

    0 讨论(0)
  • 2020-11-28 11:25

    Hint: actively refused sounds like somewhat deeper technical trouble, but...

    ...actually, this response (and also specifically errno:10061) is also given, if one calls the bin/mongo executable and the mongodb service is simply not running on the target machine. This even applies to local machine instances (all happening on localhost).

    Always rule out for this trivial possibility first, i.e. simply by using the command line client to access your db.

    See here.

    0 讨论(0)
  • 2020-11-28 11:34

    The below changes fixed my problem. I struggled with the same error for a week. I would like to share with you all that the solution is simply host = '' in the server and the client host = ip of the server.  

    0 讨论(0)
  • 2020-11-28 11:36

    10061 is WSAECONNREFUSED, 'connection refused', which means there was nothing listening at the IP:port you tried to connect to.

    There was a firewall product around the year 2000 that issued refusals instead of ignoring incoming connections to blocked ports, but this was quickly recognised as an information leak to attackers and corrected or withdrawn.

    0 讨论(0)
  • 2020-11-28 11:37

    There is no relationship between error and firewall.

    first, run server program,
    then run client program in another shell of python

    and it will work

    0 讨论(0)
提交回复
热议问题