Getting the IP Address 
Author Message
 Getting the IP Address

You can get the IP address of the local computer via C++

How can you do this in VB?



Tue, 27 Jan 2004 04:36:33 GMT  
 Getting the IP Address
Though I've never used it, it appears that the IPAddress class located in
the "System.Net" namespace will do what you need it to do...



Quote:
> You can get the IP address of the local computer via C++

> How can you do this in VB?



Tue, 27 Jan 2004 09:23:09 GMT  
 Getting the IP Address
Not entirely related to this thread, but when I was going trough the
information
about the IPAddress class, I noticed the constructor takes a Long as
parameter.
According to MSDN, this Long is "the integer value of the IP address".
However, if you look at the Address property of the class, you notice it
returns
an Integer.

So, shouldn't the constructor take an Integer instead of a Long as
parameter,
or shouldn't the Address property return a Long?

I guess they're using a Long in the constructor to be able to easily move
from IPv4 to IPv6, so the sensible thing to do (IMO) would be to let
the Address property return a Long instead of an Integer.

Is this a design flaw in the Class library, or am I missing something here?

Regards,
Pieter Philippaerts
http://www.allapi.net/dotnet/

Quote:

> Though I've never used it, it appears that the IPAddress class located in
> the "System.Net" namespace will do what you need it to do...



> > You can get the IP address of the local computer via C++

> > How can you do this in VB?



Tue, 27 Jan 2004 09:43:39 GMT  
 Getting the IP Address
Heres a sample...

Module Module1

    Sub Main()

        Dim iphe As IPHostEntry = Dns.GetHostByName(Dns.GetHostName())

        Dim ipa As IPAddress

        For Each ipa In iphe.AddressList

            Console.WriteLine(ipa.ToString())

        Next

       Console.Read()

    End Sub

End Module



Quote:
> You can get the IP address of the local computer via C++

> How can you do this in VB?



Tue, 27 Jan 2004 14:00:28 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Getting the ip address based on the MAC Address

2. Getting Second IP Address...HELP!

3. getting an ip address

4. Getting my IP address

5. Getting the IP Address

6. Getting Local IP address running a VBS script locally

7. Getting Local IP Address of Machine

8. Getting the ip address

9. getting the ip address

10. Getting the IP addresses of remote machines

11. Getting the IP address from a DNS?

12. Getting TCP/IP address from computer name

 

 
Powered by phpBB® Forum Software