为什么调用gethostbyaddr()函数,有的机器能得到机器名,有的机器得不到机器名(这些机器都能ping通)

myckd 2004-08-18 04:59:12
如题,为什么会有机器得不到机器名呢
请各位大虾解释
谢谢
...全文
114 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
myckd 2004-08-19
  • 打赏
  • 举报
回复
谢谢各位的回答,原来有的机器禁用了NETBIOS,有的机器装了防火墙
现在给分:)
aganpro 2004-08-18
  • 打赏
  • 举报
回复
可能是有些机器没禁用了netbios协议
PiggyXP 2004-08-18
  • 打赏
  • 举报
回复
因为gethostbyaddr只是获得局域网里面的那种NetBIOS主机名字

比如163我们可以ping通,但是肯定无法获得它的NetBIOS名字
DentistryDoctor 2004-08-18
  • 打赏
  • 举报
回复
可能是这些客户禁止了某些服务如DNS。
snaill 2004-08-18
  • 打赏
  • 举报
回复
The gethostbyaddr function returns a pointer to the hostent structure that contains the name and address corresponding to the given network address.

Although gethostbyaddr is deprecated by the getnameinfo function, gethostbyaddr is capable of returning a NetBIOS name; getnameinfo is not. Developers requiring NetBIOS name resolution may need to use gethostbyaddr until their applications are completely independent of NetBIOS names.

Note The capability to perform reverse lookups using the gethostbyaddr function is convenient, but such lookups are considered inherently unreliable, and should be used only as a hint.

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧