如何获取远程计算机IPadress/主机名 [英] how to get remote machine IPadress/Hostname

查看:172
本文介绍了如何获取远程计算机IPadress/主机名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

请帮助我如何获取远程计算机的IP地址/主机名.我尝试使用system.dns.gethostnamegethostentry ,但是全部都只返回本地计算机addreess.
因此,请帮助我获取以下信息.
如何通过接受一个作为输入参数来获取远程计算机的IP地址/主机名?

我需要类似以下方法的信息

1.

Hi all,

Please help me how to get remote computer IPaddress/Hostname.I tried with system.dns.gethostname and gethostentry but all are returning only local machine addreess.
So please help me to get below info.
How to get remote computer IPaddress/Hostname by accepting either on the one as Input parametes?

I need info like the below methods

1.

GetRemoteHostAdress(string IPaddress)
 { 
return hostname , FullyQualified machine name 
 } 



2.



2.

GetRemoteIPAdress(string HostName){ 
return Ipaddress , Fully Qualified MAchine Name 
} 



我要求每个人都帮助我.

谢谢



I request every one to help me.

Thanks

推荐答案

这些函数返回的名称/IP已在您的应用程序正在查询的任何DNS中注册,这可能只会是本地LAN地址.如果您尝试获取ISP分配给您的网络/路由器/调制解调器/任何内容的外部IP地址,则必须使用外部网站为您提供该IP,例如 ^ ]
Those functions are returning the names/IP''s that are registered in whatever DNS your app is querying, which is probably only going to be the local LAN address. If you''re trying to get an external IP address that your ISP has assign to your network/router/modem/whatever, then you have to use an external web site to provide that IP for you, like http://whatismyipaddress.com/[^]


参见此 ^ ].


这篇关于如何获取远程计算机IPadress/主机名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆