E-Mail:

Will The Real IP Address Please Stand Up?

There is a question that seems to plague some folks. When you go to a Web site on the Internet like whatsmyip.org, you see a number representing the IP address that Web site sees you as. If you happen to be a developer and you attempt to pull the IP address from your computer, sometimes you see a different number. A little C# snippet below shows you how to do this:

Step 1: Create a new Windows application.

Step 2: Add a line “using System.Net” to your list of imports.

Step 3: Add a list box control to your form.

Step 4: Add a button control to your form and double-click it. Enter the code below:

private void button1_Click(object sender, EventArgs e)  {

listBox1.Items.Clear();

// Get the hostname

listBox1.Items.Add System.Net.Dns.GetHostName());

// Get the IPHost hostname

IPHostEntry IPHost = Dns.GetHostByName(Dns.GetHostName());
listBox1.Items.Add("My IP address is " + IPHost.AddressList[0].ToString());  }

This shows you the host name and IP address your PC thinks it is, why do these numbers (Web site IP address and PC IP address) not match up? If you are using a high-speed connection, your modem probably has its own IP Address. That’s it!

What Do You Think?

 

Want to Start a Blog Here for Free?

Are you an expert in one subject or another? If your goal is to help others and dispense hard-earned information back to the community, stake a claim on your very own Lockergnome blog today! You can write about anything - no matter the topic. Sign-up to start blogging!

General - Sep 26, 2008

Something’s Fishmany Here

General - Oct 16, 2007

It’s Hard Enough Being A Toad

General - Sep 3, 2007

Cool And Green From Volkswagen

General - Aug 25, 2007

Okay, Okay. To Be Fair…

58 queries / 0.824 seconds.