/*
* copyright (c) 2006,四川師范大學
* all rights reserved.
* 文件名稱:getipandname
* 文件標識:見配置管理計劃書
* 文件摘要:得到本地主機的名字與ip
*/
using system;
using system.net;
/*
* 當前版本:1.0
* 軟件作者:安美洪
* 完成日期:2006年3月28日
*
* 取代版本:無
* 原作者 :無
* 完成日期:無
*/
namespace getipandname
{
class class1
{
[stathread]
static void main(string[] args)
{
//得到主機名
string name = dns.gethostname();
console.writeline("主機名字:{0}",name);
iphostentry me = dns.gethostbyname(name);
//輸出得到的ip
foreach (ipaddress ip in me.addresslist)
{
console.writeline("ip 地址:{0}",ip.tostring());
}
console.read();
}
}
}
商業源碼熱門下載www.html.org.cn
新聞熱點
疑難解答