简体   繁体   English

无法建立连接,因为目标计算机主动拒绝它

[英]No connection could be made because the target machine actively refused it

I've tried to connect to my local machine every time I try and run my program. 每次尝试运行程序时,我都尝试连接到本地计算机。 I am a nub, so it's probably a simple mistake somewhere. 我是一个小组,所以这可能是一个简单的错误。

def connect(self):
    self.conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    self.conn.connect((self.host,self.port))

That is the code causing the error. 那是导致错误的代码。 The host and port are defined. 主机和端口已定义。 Why is it giving me this error report? 为什么它给我这个错误报告?

[Errno 10061] No connection could be made because the target machine actively refused it [Errno 10061]无法建立连接,因为目标计算机主动拒绝它

It's because you haven't opened the port you are trying to connect to, nothing is listening there. 这是因为你没有打开你想要连接的端口,没有什么东西在那里听。 If you're trying to connect to a web or ftp server, start it first. 如果您尝试连接到Web或ftp服务器,请先启动它。 If you're trying to connect to another port, you need to write a server application too. 如果您尝试连接到另一个端口,则还需要编写服务器应用程序。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python-无法建立连接,因为目标计算机主动拒绝了它 - Python - No connection could be made because the target machine actively refused it Python:无法建立连接,因为目标机器主动拒绝它 - Python: No connection could be made because the target machine actively refused it WinError 10061 由于目标机器主动拒绝,无法建立连接 - WinError 10061 No connection could be made because the target machine actively refused it 无法建立连接,因为目标机器主动拒绝它 Python - No connection could be made because the target machine actively refused it Python “[WinError 10061] 无法建立连接,因为目标机器主动拒绝它” - "[WinError 10061] No connection could be made because the target machine actively refused it" EmailMultiAlternatives无法建立连接,因为目标计算机主动拒绝了它 - EmailMultiAlternatives no connection could be made because the target machine actively refused it Django Python - 无法建立连接,因为目标机器主动拒绝它 - Django Python - No connection could be made because the target machine actively refused it 无法建立连接,因为目标机器主动拒绝它(Django) - No connection could be made because the target machine actively refused it (Django) Connection was refused by other side: 10061: 由于目标机器主动拒绝,无法建立连接 - Connection was refused by other side: 10061: No connection could be made because the target machine actively refused it 无法建立新连接:[WinError 10061]无法建立连接,因为目标计算机主动拒绝了该连接 - Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM