/*
* Copyright (c) 四川师范大学
* All rights reserved
* 文件名称GetIpAndName
* 文件标识见配置管理计划书
* 文件摘要得到本地主机的名字与IP
*/
using System;
using SystemNet;
/*
* 当前版本
* 软件作者安美洪
* 完成日期年月日
*
* 取代版本无
* 原作者 无
* 完成日期无
*/
namespace GetIpAndName
{
class Class
{
[STAThread]
static void Main(string[] args)
{
//得到主机名
string name = DnsGetHostName();
ConsoleWriteLine(主机名字{}name);
IPHostEntry me = DnsGetHostByName(name);
//输出得到的IP
foreach (IPAddress ip in meAddressList)
{
ConsoleWriteLine(IP 地址{}ipToString());
}
ConsoleRead();
}
}
}