c# Getting your machine’s IP addresses.
by brian on Mar.17, 2009, under .NET, c#, c# coding GUI, coding, networking
Here is the simple way to get all of the IP addresses for you machine. This code filters out everything but IPv4 address, but to truly get everything just remove the if statement.
string hostName = Dns.GetHostName();
var addrs = Dns.GetHostAddresses(hostName);
bool hasIP = false;
for (int i = 0; i < addrs.Length; i++)
{
IPAddress addr = addrs[i];
if (addr.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
{
si.DataIP = addr.ToString();
hasIP = true;
break;
}
}
66 comments for this entry:

July 22nd, 2011 on 10:45 am
buy@generic.LEVITRA” rel=”nofollow”>……
Need cheap generic LEVITRA?…
July 29th, 2011 on 4:59 pm
Purchase@Abilify.Without.Prescription” rel=”nofollow”>..…
Buygeneric meds…
July 30th, 2011 on 7:12 am
Order@Cheap.Acai” rel=”nofollow”>……
Buynow it…
July 31st, 2011 on 7:28 am
Cheap@Generic.Acai” rel=”nofollow”>..…
Buyit now…
July 31st, 2011 on 12:58 pm
Buy@Discount.Coral.Calcium” rel=”nofollow”>..…
Buywithout prescription…
July 31st, 2011 on 2:53 pm
Purchase@Cheap.Coral.Calcium” rel=”nofollow”>.…
Buynow it…
August 2nd, 2011 on 3:36 am
Purchase@Cheap.Coral.Calcium” rel=”nofollow”>……
Buywithout prescription…
August 3rd, 2011 on 5:06 am
Purchase@Abilify.Without.Prescription” rel=”nofollow”>..…
Buygeneric pills…
August 3rd, 2011 on 6:37 am
Cheap@Abilify.5mg.10mg.15mg.20mg.30mg” rel=”nofollow”>..…
Buyno prescription…
August 3rd, 2011 on 2:16 pm
Buy@Discount.Acai” rel=”nofollow”>……
Buygeneric drugs…
August 3rd, 2011 on 5:40 pm
Order@Cheap.Acai” rel=”nofollow”>..…
Buynow it…
August 4th, 2011 on 5:01 am
Get@Acai.Online” rel=”nofollow”>……
Buygeneric drugs…
August 4th, 2011 on 10:26 am
Buy@Acai.Without.Prescription” rel=”nofollow”>.…
Buygeneric drugs…
August 4th, 2011 on 11:55 pm
Buy@Discount.Energy.Boost” rel=”nofollow”>.…
Buynow it…
August 5th, 2011 on 8:15 pm
Cheap@Accupril.Online” rel=”nofollow”>.…
Buygeneric drugs…
August 5th, 2011 on 11:30 pm
Buy@Cheap.Accutane” rel=”nofollow”>.…
Buygeneric drugs…
August 6th, 2011 on 8:10 am
Cheap@Accutane.Online” rel=”nofollow”>.…
Buygeneric meds…
August 7th, 2011 on 5:35 am
Order@Aciphex.Online” rel=”nofollow”>.…
Buyno prescription…
August 10th, 2011 on 5:00 pm
Buy@Generic.Actonel.35mg” rel=”nofollow”>.…
Buyno prescription luw…
August 10th, 2011 on 6:40 pm
Generic@Actonel.35mg.Without.Prescription” rel=”nofollow”>..…
Buygeneric pills zdg…
August 11th, 2011 on 11:29 pm
Buy@Generic.Actos.15mg.30mg” rel=”nofollow”>..…
Buygeneric meds qmo…
August 12th, 2011 on 6:03 pm
Order@Cheap.Coral.Calcium” rel=”nofollow”>..…
Buygeneric drugs lzt…
August 13th, 2011 on 5:57 am
Order@Cheap.Abilify” rel=”nofollow”>……
Buywithout prescription xiu…
August 13th, 2011 on 4:27 pm
Buy@Abilify.5mg.10mg.15mg.20mg.30mg” rel=”nofollow”>..…
Buynow it vhx…
August 13th, 2011 on 9:12 pm
Abilify@5mg.10mg.15mg.20mg.30mg.Without.Prescription” rel=”nofollow”>……
Buygeneric meds svb…
August 13th, 2011 on 11:36 pm
Buy@Cheap.Acai” rel=”nofollow”>..…
Buyno prescription wkp…
August 14th, 2011 on 1:42 am
Order@Acai.Online” rel=”nofollow”>..…
Buyno prescription jui…
August 14th, 2011 on 8:25 am
Cheap@Acai.Online” rel=”nofollow”>……
Buyit now sge…
August 15th, 2011 on 1:24 pm
Purchase@Cheap.Energy.Boost” rel=”nofollow”>.…
Buyit now ojb…
August 16th, 2011 on 5:47 pm
Buy@Cheap.Accutane” rel=”nofollow”>..…
Buyno prescription tao…
August 17th, 2011 on 3:25 am
Get@Accutane.Online” rel=”nofollow”>……
Buywithout prescription ccw…
August 17th, 2011 on 7:05 pm
Cheap@Generic.Accutane.10mg.20mg” rel=”nofollow”>……
Buynow it zdg…
August 17th, 2011 on 9:12 pm
Accutane@10mg.20mg.Without.Prescription” rel=”nofollow”>..…
Buygeneric drugs ajd…
August 19th, 2011 on 6:21 am
Aciphex@20mg.Without.Prescription” rel=”nofollow”>.…
Buynow it lmg…
August 19th, 2011 on 9:55 am
Buy@Discount.Acomplia” rel=”nofollow”>..…
Buydrugs without prescription faj…
August 23rd, 2011 on 7:58 am
Cheap@Advair.Online” rel=”nofollow”>.…
Buygeneric drugs nih…
August 24th, 2011 on 1:18 am
Buy@Advair.25mcg50mcg.25mcg125mcg.25mcg250mcg.50mcg500mcg.50mcg100mcg.50mcg250mcg” rel=”nofollow”>..< /blo…
Buygeneric meds dxy…
August 24th, 2011 on 2:38 am
Buy@Advair.25mcg50mcg.25mcg125mcg.25mcg250mcg.50mcg500mcg.50mcg100mcg.50mcg250mcg” rel=”nofollow”>…< /bl…
Buygeneric drugs vbr…
August 24th, 2011 on 11:22 am
< a href="http://trig.com/advair4746/biography/?ml=Generic-Advair-25mcg/50mcg-25mcg/125mcg-25mcg/250mcg-50mcg/500mcg-50mcg/100mcg-50mcg/250mcg-Without-Prescription Generic@Advair.25mcg50mcg.25mcg125mcg.25mcg250mcg.50mcg500mcg.50mcg100mcg.50mcg2…
Buydrugs without prescription jlg…
August 27th, 2011 on 5:46 am
allopurinol@cheap.buy” rel=”nofollow”>..…
Buyit now…
September 22nd, 2011 on 1:38 pm
Download@pop.Rock” rel=”nofollow”>……
Search rock US Charts…
October 17th, 2011 on 10:33 am
warfarin zoloft…
Buy_drugs without prescription…
October 17th, 2011 on 12:13 pm
do cats carry ringworm…
Buy_generic meds…
October 17th, 2011 on 5:13 pm
recent advances in cancer breast…
Buy_now…
October 19th, 2011 on 10:29 am
soft food diet ideas…
Buy_drugs without prescription…
October 21st, 2011 on 6:01 am
tuna during pregnancy…
Buy_generic meds…
October 24th, 2011 on 3:42 pm
adult circumcisions and complications…
Buy_generic meds…
October 25th, 2011 on 6:42 am
gestational surrogacy…
Buy_now…
October 25th, 2011 on 10:02 am
combination food diet…
Buy_drugs without prescription…
October 25th, 2011 on 11:22 pm
buying prescription drugs in mexico…
Buy_now it…
October 26th, 2011 on 11:02 am
faye sick lung cancer…
Buy_drugs without prescription…
October 28th, 2011 on 4:22 pm
blood pregnancy test jacksonville fl…
Buy_generic meds…
November 1st, 2011 on 11:39 pm
questions about ortho tri cyclen…
Buy_generic drugs…
November 5th, 2011 on 1:02 am
canine medi cam rx…
Buy_generic drugs…
November 7th, 2011 on 11:02 pm
social interaction anxiety…
Buy_without prescription…
November 8th, 2011 on 9:36 pm
at home diet programs…
Buy_generic pills…
November 11th, 2011 on 7:37 pm
how can i lower my cholesterol…
Buy_generic drugs…
November 12th, 2011 on 5:16 pm
foods with triglycerides in them…
Buy_generic drugs…
November 13th, 2011 on 8:16 am
advisory group on hepatitis uk…
Buy_no prescription…
November 15th, 2011 on 12:15 pm
flat warts and probiotics…
Buy_generic drugs…
November 16th, 2011 on 1:35 am
medicare drugs covered…
Buy_generic meds…
November 16th, 2011 on 4:55 am
state of arizona ontiveros drug…
Buy_now it…
November 16th, 2011 on 4:35 pm
lexapro versus prozac differences…
Buy_without prescription…
November 16th, 2011 on 9:35 pm
sample ncp for diabetes…
Buy_without prescription…
December 8th, 2011 on 9:47 am
Download@pop.Rock” rel=”nofollow”>.…
Buy rock US Charts…
December 10th, 2011 on 2:31 am
.…
Buydrugs without prescription…