📄 iptoinformation.cs
字号:
using System;
using System.Net;
class IpToInformation
{
static void Main(string[] args)
{
int i=0;
string IpString;
Console.Write("Please enter a IP address:");
IpString=Console.ReadLine();
try
{
IPAddress myIP=IPAddress.Parse(IpString);
IPHostEntry myHost=new IPHostEntry();
myHost=Dns.GetHostByAddress(myIP);
string HostName=myHost.HostName.ToString();
Console.WriteLine("The host name is {0}",HostName);
Console.WriteLine("The relative IP:");
for(i=0;i<myHost.AddressList.Length;i++)
{
Console.WriteLine(myHost.AddressList[i]);
}
if(myHost.Aliases.Length>0)
{
Console.WriteLine("The Aliases of the host:");
for(i=0;i<myHost.Aliases.Length;i++)
{
Console.WriteLine(myHost.Aliases[i]);
}
}
else
{
Console.WriteLine("The host have no alias.");
}
}
catch(Exception ee)
{
Console.WriteLine(ee.Message);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -