using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
namespace TestGetIp
{
class Program
{
static void Main(string[] args)
{
//获取本地ip
string strHostIP = "";
IPHostEntry oIPHost = Dns.GetHostEntry(Environment.MachineName);
if (oIPHost.AddressList.Length > 0)
strHostIP = oIPHost.AddressList[0].ToString();
Console.Write(strHostIP);
}
}
}