How to get IP address of our system
using systemname?
The System.net namespace provides the information about IP Address . The
following C# program shows how to find the IP Address of a host.
private void
button1_Click(object sender, EventArgs e)
{
try
{
IPHostEntry
hostname = Dns.GetHostByName(textBox1.Text);
IPAddress[]
ip = hostname.AddressList;
textBox2.Text =
ip[0].ToString();
}
catch
(Exception ex)
{
Console.WriteLine(ex.ToString());
}
}

No comments:
Post a Comment
Comment Here..