socket.gaierror: [Errno 11003] getaddrinfo 失败
if data.find('!scan') != -1:
nick = data.split('!')[ 0 ].replace(':','')
targetip = socket.gethostbyname(str(arg))
sck.send('PRIVMSG ' + chan + " :" ' scanning host' + targetip + '\r\n')
for i in range(20, 1025):
s = socket(AF_INET, SOCK_STREAM)
result = s.connect_ex((targetip, i))
if (result == 0) :
s.send('PRIVMSG ' + chan + " :" 'port %d: OPEN' % (i,) + '\r\n')
s.close()
我收到此错误:
targetip = socket.gethostbyname(str(arg))
socket.gaierror: [Errno 11003] getaddrinfo failed
if data.find('!scan') != -1:
nick = data.split('!')[ 0 ].replace(':','')
targetip = socket.gethostbyname(str(arg))
sck.send('PRIVMSG ' + chan + " :" ' scanning host' + targetip + '\r\n')
for i in range(20, 1025):
s = socket(AF_INET, SOCK_STREAM)
result = s.connect_ex((targetip, i))
if (result == 0) :
s.send('PRIVMSG ' + chan + " :" 'port %d: OPEN' % (i,) + '\r\n')
s.close()
I get this error:
targetip = socket.gethostbyname(str(arg))
socket.gaierror: [Errno 11003] getaddrinfo failed
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Windows 上,
socket.gethostbyname()
调用getaddrinfo()
Winsock API 调用,并出现 errno 11003 - WSANO_RECOVERY 可能是由于未设置 SYSTEMROOT 环境变量引起的。在调用socket.gethostbyname之前检查os.environ是否包含SYSTEMROOT,例如:
On Windows,
socket.gethostbyname()
invokes thegetaddrinfo()
Winsock API call, and errno 11003 - WSANO_RECOVERY may be caused by the SYSTEMROOT environment variable not being set.Check if os.environ contains SYSTEMROOT before calling socket.gethostbyname, ex: