python - Socket.gethostbyaddr() 在 linux 中返回空别名列表,但在 Windows 中不返回
问题描述
Python 的 socket.gethostbyaddr() 在 linux 上返回空的别名列表
我在 Windows 和 Linux 上都尝试过 Python2 和 Python3。它可以在 Windows 上运行,但不能在 Linux(Ubuntu 和 RedHat)上使用相同的 IP 进行解析。我还在这两个系统上进行了wireshark 捕获,我们清楚地看到包含所有别名的DNS 答案。
import socket
print(socket.gethostbyaddr('192.168.11.1'))
在 Windows 上,我得到这样的答案,这是可以的:
('test123.com', ['alias1.test123.com', 'alias2.test123.com'], ['192.168.11.1'])
在linux上我得到:
('alias1.test123.com', [], ['192.168.11.1'])
有人知道修复吗?
解决方案
推荐阅读
- database - ORA-65169: 尝试复制文件时遇到错误
- sql-server - EF Core Add-Migration 使用 ColumnName1 生成额外的列
- database - 无法在 SQL Server Management Studio 的 SQLite 数据库(.db 文件)中运行 JSON_VALUE
- python - 加载 Keras 模型并使用它进行预测
- excel - 使用 VBA 从 Excel 格式化电子邮件正文
- r - rbind.fill 基于通用模式 R
- outlook - 如何将 Azure Devops 日历集成到 Outlook
- c# - 使用 IIS 托管服务的问题 - 本地和远程
- python - Manjaro 上的旧版 Python (Arch Linux)
- regex - 我可以在单个正则表达式字符串中使用正则表达式提取值吗