简体   繁体   English

TimeoutError:[Errno 60] 操作超时(Python 套接字请求)

[英]TimeoutError: [Errno 60] Operation timed out (Python socket request)

I am fairly new to Python (just started today) but am really struggling with this:我对 Python 还很陌生(今天才开始),但我真的很挣扎:

#! /usr/bin/python

import socket

s=socket.socket()
s.connect(("<my ip addres>", 22))

answer=s.recv(1024)
print(answer)

s.close

I believe I am meant to be getting some sort of 'banner' response but it gives nothing for a few minutes before spouting the following error: TimeoutError: [Errno 60] Operation timed out我相信我应该得到某种“横幅”响应,但在发出以下错误之前的几分钟内它什么也没给出: TimeoutError:[Errno 60] Operation timed out

Why would this be happening?为什么会发生这种情况?

First of all make sure you connect to port 22. Then make sure your operating system's firewall doesn't block incoming connections to port 22. In case the address you have configured for the server is "localhost" and try to connect from another machine you won't be able to connect.首先确保您连接到端口 22。然后确保您的操作系统的防火墙不会阻止到端口 22 的传入连接。如果您为服务器配置的地址是“localhost”并尝试从另一台机器连接您将无法连接。 In that case you shoud use "" as ip address.在这种情况下,您应该使用“”作为 IP 地址。

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

相关问题 TimeoutError: [Errno 60] 操作超时 (starttls()) - TimeoutError: [Errno 60] Operation timed out (starttls()) Python / Google Maps API - TimeoutError: [Errno 60] 从终端调用 function 时操作超时 - Python / Google Maps API - TimeoutError: [Errno 60] Operation timed out when calling a function from the terminal 熊猫to_csv()总是给出TimeoutError:[Errno 60]操作超时 - Pandas to_csv() always give TimeoutError: [Errno 60] Operation timed out TimeoutError:读取操作超时 - TimeoutError: The read operation timed out 为什么我在 Pycharm 中使用 python 代码收到此错误:“TimeoutError: [Errno 110] Connection timed out”? - Why am I getting this error: "TimeoutError: [Errno 110] Connection timed out" using python code in Pycharm? Python FTP:“超时错误:[Errno 110] 连接超时”但我可以在终端中与 sftp 连接 - Python FTP: "TimeoutError: [Errno 110] Connection timed out" but I can connect with sftp in terminal Tensorflow urllib.error.URLError:<urlopen error Errno 60 Operation timed out> - Tensorflow urllib.error.URLError: <urlopen error Errno 60 Operation timed out> celery multi celery.exceptions.TimeoutError: 操作超时 - celery multi celery.exceptions.TimeoutError: The operation timed out pygsheet操作超时[Errno 60] - pygsheet operation time out [Errno 60] 在Python中捕获“ socket.timeout读取操作超时” - catching “socket.timeout The read operation timed out” in python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM