如何修复“ TimeoutError:连接失败”?

时间:2019-07-15 23:43:11

标签: python python-3.x windows sockets connection

我正在制作一个在线视频游戏,只是下载了这些文件(可能)对服务器有帮助,但是我遇到了TimeoutError:[WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time,...正当我尝试进行测试时它。

这是(希望)得到一份工作,我打算在游戏完成后马上出售它。我已经尝试过google,但这使我退回到了一个没有帮助的现有问题。

self.host = "10.11.250.207" # For this to work on your machine this must be
                            # equal to the ipv4 address of the machine
                            # running the server
                            # You can find this address by typing ipconfig
                            # in CMD and copying the ipv4 address. Again
                            # this must be the servers ipv4 address. This
                            # field will be the same for all your clients.
self.port = 5555
self.addr = (self.host, self.port)
self.id = self.connect()

您看到评论了吗?我试着按照它说的去做,说它可以用,但是错误与那无关。

完整的错误是这样的:

Traceback (most recent call last):
  File "C:\Users\roche\Documents\games\base-defense\network.py", line 30, in <module>
    n = Network()
  File "C:\Users\roche\Documents\games\base-defense\network.py", line 13, in __init__
    self.id = self.connect()
  File "C:\Users\roche\Documents\games\base-defense\network.py", line 16, in connect
    self.client.connect(self.addr)
TimeoutError: [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

0 个答案:

没有答案