0

I am writing a simple Client-Server connection. When I try it at home, where all devices are on the same network, it is all fine and the code works perfect. But when I try to use it on devices with different networks, this error occures:

[WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Client Code:

host = 'ip_example'
port = 3333
self.s = socket(AF_INET6, SOCK_STREAM)
print("Connecting")
self.s.connect((host, port))

Server Code:

host = ''
port = 3333
self.s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
self.s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.s.bind((host, port))
self.s.listen(3)
self.connection, self.addr = self.s.accept()

Can someone help me? (BTW, I even tried to disable the firewall)

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Prep
  • 1
  • 2
    Are you sure that whatever you used instead of `ip_example` is an accessible address for the server? Can you ping it from the client machine, for example? – jasonharper Feb 02 '20 at 02:02
  • Does this answer your question? [Python: URLError: –  Feb 02 '20 at 09:24
  • Instead of `ip_example` i am using a ipv6 which i have from cmd when you enter "ipconfig" – Prep Feb 02 '20 at 10:01
  • I just tried the suggestion of bosnian coder, but unfortunately it does not work either – Prep Feb 02 '20 at 10:22

0 Answers0