By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,116 Members | 1,509 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,116 IT Pros & Developers. It's quick & easy.

Find IP Address

P: n/a
Hi, how to find IP address. Thanks
Nov 21 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
IP Address of the local machine? If yes, this is one way:

Dim local As IPHostEntry = Dns.Resolve(Dns.GetHostName())
For ip As IPAddress In local
Console.WriteLine (ip)
Next

Hope this helps.

"Souljaz" <an*******@discussions.microsoft.com> wrote in message
news:12****************************@phx.gbl...
Hi, how to find IP address. Thanks
Nov 21 '05 #2

P: n/a
Hi there, where should I put these code,
Another thing I am looking global IP address

Any idea?
-----Original Message-----
IP Address of the local machine? If yes, this is one way:

Dim local As IPHostEntry = Dns.Resolve(Dns.GetHostName())
For ip As IPAddress In local
Console.WriteLine (ip)
Next

Hope this helps.

"Souljaz" <an*******@discussions.microsoft.com> wrote in messagenews:12****************************@phx.gbl...
Hi, how to find IP address. Thanks
.

Nov 21 '05 #3

P: n/a
Hi,

Here an alternative
\\\Dim IPAdres As String = System.Net.Dns.Resolve _
(SystemInformation.ComputerName).AddressList(0).To String
///

I hope this helps?

Cor
<an*******@discussions.microsoft.com>
Hi there, where should I put these code,
Another thing I am looking global IP address

Any idea?
-----Original Message-----
IP Address of the local machine? If yes, this is one way:

Dim local As IPHostEntry = Dns.Resolve(Dns.GetHostName())
For ip As IPAddress In local
Console.WriteLine (ip)
Next

Hope this helps.

"Souljaz" <an*******@discussions.microsoft.com> wrote in

message
news:12****************************@phx.gbl...
Hi, how to find IP address. Thanks
.

Nov 21 '05 #4

P: n/a
Import the System.Net namespace and this should work from any module/class.
You might want to index (like local(0)) the array returned from
Dns.Resolve() to access the specific address for your processing.

Can you give more info on what you mean by 'global ip address'?

<an*******@discussions.microsoft.com> wrote in message
news:17****************************@phx.gbl...
Hi there, where should I put these code,
Another thing I am looking global IP address

Any idea?
-----Original Message-----
IP Address of the local machine? If yes, this is one way:

Dim local As IPHostEntry = Dns.Resolve(Dns.GetHostName())
For ip As IPAddress In local
Console.WriteLine (ip)
Next

Hope this helps.

"Souljaz" <an*******@discussions.microsoft.com> wrote in messagenews:12****************************@phx.gbl...
Hi, how to find IP address. Thanks
.

Nov 21 '05 #5

P: n/a
"Souljaz" <an*******@discussions.microsoft.com> schrieb:
how to find IP address.


<URL:http://www.activevb.de/rubriken/vbdotnettipps/tipp0016.html>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #6

P: n/a
Hi all,

Thanks Cor Ligthert for the code, its work. But that is
to find local IP address right. What I want to find is
the dynamic IP address that provided by the ISP. Thanks
-----Original Message-----
Hi,

Here an alternative
\\\Dim IPAdres As String = System.Net.Dns.Resolve _
(SystemInformation.ComputerName).AddressList(0).T oString
///

I hope this helps?

Cor
<an*******@discussions.microsoft.com>
Hi there, where should I put these code,
Another thing I am looking global IP address

Any idea?
-----Original Message-----
IP Address of the local machine? If yes, this is one way:
Dim local As IPHostEntry = Dns.Resolve(Dns.GetHostName ())For ip As IPAddress In local
Console.WriteLine (ip)
Next

Hope this helps.

"Souljaz" <an*******@discussions.microsoft.com> wrote
in message
news:12****************************@phx.gbl.. .
Hi, how to find IP address. Thanks
.

.

Nov 21 '05 #7

P: n/a
Hi,

I have no dynamic IP adress provided by the ISP, however is that not the
same?

When you have more Ip adresses I would look at the code that Shiva provided.

Cor
Nov 21 '05 #8

P: n/a
It is not the same, The local IP address is Ip address
that is set by the windows or by the user. If you
connected to LAN you will have Local IP address that can
be set dynamic or static for the particular computer in
LAN. But the IP Address that provided by the ISP is the
global IP address or WAN IP address. It is normally set
by the ISP and everytime you reconnect again the IP
address will be change.

try to go to this sites
http://www.html-kit.com/e/browconninfo.cgi

The sites will show you the IP address that provided by
the ISP.

Most of the code that provided here is to find the local
IP address. WHat I want to find the the IP address that
is provided by the ISP.

Any idea guys?

Thanks
-----Original Message-----
Hi,

I have no dynamic IP adress provided by the ISP, however is that not thesame?

When you have more Ip adresses I would look at the code that Shiva provided.
Cor
.

Nov 21 '05 #9

P: n/a
As I asked did you try the sample of Shiva.

You can see your IP adresses by the way by doing in the DOS prompt

IPConfig

I hope this helps?

Cor

<an*******@discussions.microsoft.com>
It is not the same, The local IP address is Ip address
that is set by the windows or by the user. If you
connected to LAN you will have Local IP address that can
be set dynamic or static for the particular computer in
LAN. But the IP Address that provided by the ISP is the
global IP address or WAN IP address. It is normally set
by the ISP and everytime you reconnect again the IP
address will be change.

try to go to this sites
http://www.html-kit.com/e/browconninfo.cgi

The sites will show you the IP address that provided by
the ISP.

Most of the code that provided here is to find the local
IP address. WHat I want to find the the IP address that
is provided by the ISP.

Any idea guys?

Thanks
-----Original Message-----
Hi,

I have no dynamic IP adress provided by the ISP, however

is that not the
same?

When you have more Ip adresses I would look at the code

that Shiva provided.

Cor
.

Nov 21 '05 #10

P: n/a
Hi shiva,
I try to put your code in form_load

Dim local As IPHostEntry = Dns.Resolve(Dns.GetHostName())
For ip As IPAddress In local
Console.WriteLine (ip)
Next

But there is an error saying that:
'For' loop control variable cannot be of
type 'System.Net.IPAddress'.

Whats the problem?
-----Original Message-----
Import the System.Net namespace and this should work from any module/class.You might want to index (like local(0)) the array returned fromDns.Resolve() to access the specific address for your processing.
Can you give more info on what you mean by 'global ip address'?
<an*******@discussions.microsoft.com> wrote in message
news:17****************************@phx.gbl...
Hi there, where should I put these code,
Another thing I am looking global IP address

Any idea?
-----Original Message-----
IP Address of the local machine? If yes, this is one way:
Dim local As IPHostEntry = Dns.Resolve(Dns.GetHostName ())For ip As IPAddress In local
Console.WriteLine (ip)
Next

Hope this helps.

"Souljaz" <an*******@discussions.microsoft.com> wrote in

message
news:12****************************@phx.gbl...
Hi, how to find IP address. Thanks
.

.

Nov 21 '05 #11

P: n/a
Sorry, I missed .AddressList in the For statement:

Here is the working code:

Dim local As IPHostEntry = Dns.Resolve(Dns.GetHostName())
For Each ip As IPAddress In local.AddressList
Console.WriteLine (ip)
Next

<an*******@discussions.microsoft.com> wrote in message
news:1a****************************@phx.gbl...
Hi shiva,
I try to put your code in form_load

Dim local As IPHostEntry = Dns.Resolve(Dns.GetHostName())
For ip As IPAddress In local
Console.WriteLine (ip)
Next

But there is an error saying that:
'For' loop control variable cannot be of
type 'System.Net.IPAddress'.

Whats the problem?
-----Original Message-----
Import the System.Net namespace and this should work from any module/class.You might want to index (like local(0)) the array returned fromDns.Resolve() to access the specific address for your processing.
Can you give more info on what you mean by 'global ip address'?
<an*******@discussions.microsoft.com> wrote in message
news:17****************************@phx.gbl...
Hi there, where should I put these code,
Another thing I am looking global IP address

Any idea?
-----Original Message-----
IP Address of the local machine? If yes, this is one way:
Dim local As IPHostEntry = Dns.Resolve(Dns.GetHostName ())For ip As IPAddress In local
Console.WriteLine (ip)
Next

Hope this helps.

"Souljaz" <an*******@discussions.microsoft.com> wrote in

message
news:12****************************@phx.gbl...
Hi, how to find IP address. Thanks
.

.

Nov 21 '05 #12

P: n/a
They are the same thing... The IP you connect to the net is the one on the
machine.

If you have a gateway/router/proxy then you have to run your code on that
machine. You're machine has no idea what IP the other hardware is using.

<an*******@discussions.microsoft.com> wrote in message
news:0d****************************@phx.gbl...
Hi all,

Thanks Cor Ligthert for the code, its work. But that is
to find local IP address right. What I want to find is
the dynamic IP address that provided by the ISP. Thanks
-----Original Message-----
Hi,

Here an alternative
\\\Dim IPAdres As String = System.Net.Dns.Resolve _
(SystemInformation.ComputerName).AddressList(0).T oString
///

I hope this helps?

Cor
<an*******@discussions.microsoft.com>
Hi there, where should I put these code,
Another thing I am looking global IP address

Any idea?
-----Original Message-----
IP Address of the local machine? If yes, this is one way:
Dim local As IPHostEntry = Dns.Resolve(Dns.GetHostName ())For ip As IPAddress In local
Console.WriteLine (ip)
Next

Hope this helps.

"Souljaz" <an*******@discussions.microsoft.com> wrote in message
news:12****************************@phx.gbl.. .
Hi, how to find IP address. Thanks
.

.

Nov 21 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.