Displays your IP address and hostname
This example will display your IP address and hostname using C#
using System;
using System.Net;
class MYDns
{
public static void Main ()
{
string hostName = Dns.GetHostName();
Console.WriteLine("Local hostname: {0}", hostName);
IPHostEntry myself = Dns.GetHostByName(hostName);
foreach (IPAddress address in myself.AddressList)
{
Console.WriteLine("IP Address: {0}", address.ToString());
}
}
}
Related posts:
- find the hostname for a known IP address find the hostname for a known IP address with C...
- perform a DNS query perform a DNS query on a domain name using C...
- get ip address get ip address with VB.net Module Module1 Sub Main() Dim...
- Log users IP address This ASP example will retrieve a visitors IP address and...
- Display network information using Powershell This example will display various snippets of network related information...
Related posts brought to you by Yet Another Related Posts Plugin.






















