Multimobile Development: Building Applications for any Smartphone
IP Detection
Messages   Related Types
This message was discovered on microsoft.public.dotnet.languages.vb.


Federico
How Can I get the Local IP Address in VB.NET on a Windows 2000 Machine???
And on Win9x ?

Thanks a lot

Federico
___________________________________________________
Click here to reveal e-mail address

Reply to this message...
Vote that this is a GOOD answer...
 
Really good experience at the Apple Store
MonoDroid – looking *awesome*
 
    
Jun Su
Hi Federico,

Based on my knowledge, there is no way to get the IP address of local
computer directly. You need get the host name of the local computer first.
Then, you can get the IP addresses from the name. For several IP addresses
that can bind to a local computer, there is an array returned from the
method GetHostByName. The following is an sample. It prints out the host
name and the IP addresses.

using System;
using System.Net;

namespace ConsoleApplication1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
string host;
host = Dns.GetHostName();
Console.WriteLine(host);
IPHostEntry i = Dns.GetHostByName(host);
foreach (IPAddress a in i.AddressList)
{
Console.WriteLine(a);
}
}
}
}

Thanks,
Jun Su
Click here to reveal e-mail address
---
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. ? 2001 Microsoft Corporation. All rights
reserved.

Reply to this message...
Vote that this is a GOOD answer...
 
First volume of Multimobile Development nearly ready to go to press
A mention on Developing for the iPhone and Android: The pros and cons
 
 
System.Console
System.Net.Dns
System.Net.IPAddress
System.Net.IPHostEntry




Multimobile Development: Building Applications for any Smartphone
Ad
BootFX
Reliable and powerful .NET application framework.
iOS, Android and Windows Phone Development Training and Consultancy
Hosted by RackSRV Communications
 
Multimobile Development: Building Applications for any Smartphone
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734