How to get IP my IP address 
Author Message
 How to get IP my IP address

I can get my hostname by:

        Dim s As String = Net.Dns.GetHostName()

How do I get my current IP address?

thanks,
Jarrod



Mon, 30 Aug 2004 17:13:02 GMT  
 How to get IP my IP address
this seems to work...

Dim s As String =
Net.Dns.GetHostByName(Net.Dns.GetHostName()).AddressList(0).ToString


Quote:
> I can get my hostname by:

>         Dim s As String = Net.Dns.GetHostName()

> How do I get my current IP address?

> thanks,
> Jarrod



Mon, 30 Aug 2004 21:16:24 GMT  
 How to get IP my IP address
Could you confirm whether this works in all circumstances? My bet is that
would only return the internal/local LAN IP address.

An irritating bug in Age Of Kings is that the 'helpful' feature which gives
your IP address so that you can tell people the address you are hosting on
(usually after the zone has screwed up a lobby launch :-/) can give the
INTERNAL ip address rather than the external IP address. This is obviously
on a machine directly connected to the internet (modem, whatever) but also
has a LAN adaptor.

Of course, you could just enumerate them all and check they aren't internal
ones but is there a way of getting the external IP address with the first
bite?

TIA



Tue, 31 Aug 2004 00:01:39 GMT  
 How to get IP my IP address
If that's the only reason you want it, just bring up a DOS box and type
IPCONFIG.  That will give you your *REAL* IP address.  My friend had to do
that when we played Diablo II... (he uses Microsoft's ISP service)



Quote:
> Could you confirm whether this works in all circumstances? My bet is that
> would only return the internal/local LAN IP address.

> An irritating bug in Age Of Kings is that the 'helpful' feature which
gives
> your IP address so that you can tell people the address you are hosting on
> (usually after the zone has screwed up a lobby launch :-/) can give the
> INTERNAL ip address rather than the external IP address. This is obviously
> on a machine directly connected to the internet (modem, whatever) but also
> has a LAN adaptor.

> Of course, you could just enumerate them all and check they aren't
internal
> ones but is there a way of getting the external IP address with the first
> bite?

> TIA



Tue, 31 Aug 2004 01:14:28 GMT  
 How to get IP my IP address
Heh. Way ahead of u on that one. I always have to explain it to the ppl who
think 192.168.01 *is* their IP address :-)

How would I produce the correct IP address using code so I could duplicate
the AOK function (but not the error) in a game I write?



Tue, 31 Aug 2004 02:23:30 GMT  
 How to get IP my IP address



Quote:
> Heh. Way ahead of u on that one. I always have to explain it to the ppl
who
> think 192.168.01 *is* their IP address :-)

> How would I produce the correct IP address using code so I could duplicate
> the AOK function (but not the error) in a game I write?

Try this:
Imports System

Imports System.Net

Imports System.Net.Sockets

Public Function LocalHostIP() As String

Dim objEPLocal As IPEndPoint

Dim objSock As Socket

objSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.IP)

objEPLocal = CType(m_objSock.LocalEndPoint, IPEndPoint)

LocalHostIP = m_objEPLocal.Address.ToString()

 objSock = nothing
objEPLocal=nothing

End Function

--
Sam



Tue, 31 Aug 2004 10:13:28 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Getting the ip address based on the MAC Address

2. Getting a machine's MAC address given a NETBIOS machine name or IP address

3. TCP/IP IP address and multiple adapters

4. changing of IP-address and other IP parameters

5. getting real IP instead of Proxy ip

6. Getting the IP Address

7. getting IP address

8. getting ip address

9. Getting IP Address from VB5

10. Getting IP address of current machine with VB5

11. Getting Second IP Address...HELP!

12. Getting IP Address on machine I am using

 

 
Powered by phpBB® Forum Software