如何将多台计算机连接到套接字服务器?

时间:2020-02-06 10:56:27

标签: python python-3.x sockets server

我正在使用套接字和线程包制作一个基于python的小型聊天应用程序。

应用程序的一部分是服务器,它可以按预期工作。 另一部分是客户端应用程序,也可以正常工作。 客户端输入所需的主机IP和主机已为服务器打开的端口。我可以将本地客户端连接到正在运行的服务器(客户端和服务器在同一台计算机上),但是当我尝试使用另一台运行客户端的计算机连接到服务器时,出现TimeoutError;

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\user\Documents\lib\tkinter\__init__.py", line 1705, in __call__
    return self.func(*args)
  File "C:\Users\user\Desktop\Client.py", line 46, in connect
    client_socket.connect(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

不确定为什么会这样。我以为该端口可能已被阻止,但是在Google搜索之后,我还没有发现任何其他人遇到此问题的示例。

我已经将服务器和客户端应用程序都上传到了github仓库; https://github.com/gamer1117/chatapplication

感谢所有帮助。

0 个答案:

没有答案