[英]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.