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

后端 未结 14 652
無奈伤痛
無奈伤痛 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:39

    instead of localhost of '0.0.0.0', use local network address as host in case of both - the server and the client - code.

    host = '192.168.12.12' port = 12345

    use this host address when binding and connecting to the socket.

    server.bind((host, port)) client.connect((host, port))

    this change solved the issue for me.

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

    if you have remote server installed on you machine. give server.py host as "localhost" and the port number. then client side , you have to give local ip- 127.0.0.1 and port number. then its works

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

    Using the examples from: https://docs.python.org/3.2/library/socketserver.html I determined that I needed to set the HOST port to the machine I had the server program running on. So TCPServer on 192.168.0.1 HOST = TCPServer IP 192.168.0.1 then I had to set the TCPClient side to point to the TCPServer IP. So the TCPClient HOST value = 192.168.0.1 - Sorry, that's the best I can describe it.

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

    I was facing a similar problem when I was calling REST API using python library and what I found that my server was going into sleep mode which was leading to this. As soon as I logged in to the server via Remote Desktop Connection, my API call used to work.

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

    The first: Please make sure your port '12345' is opening and then when you using a different network. You have to use the IP address in LAN. Don't use the 'localhost' or '127.0.0.1'. The solution here is: In server

    host = '192.168.1.12' #Ip address in LAN network
    

    In client

    host = '27.32.123.32' # external IP Address
    

    Hope it works for you

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

    the short term solution is to use the default iis host and port normally 120.0.0.1 and 80 respectively. However am still looking for a more versatile solution.

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