364,112 Members | 2160 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

Find IP Address

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


Shiva
P: n/a
Shiva
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" <anonymous@discussions.microsoft.com> wrote in message
news:121001c4e725$e70d47f0$a301280a@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?[color=blue]
>-----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" <anonymous@discussions.microsoft.com> wrote in[/color]
message[color=blue]
>news:121001c4e725$e70d47f0$a301280a@phx.gbl...
>Hi, how to find IP address. Thanks
>
>
>.
>[/color]
Nov 21 '05 #3

Cor Ligthert
P: n/a
Cor Ligthert
Hi,

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

I hope this helps?

Cor


<anonymous@discussions.microsoft.com>[color=blue]
> Hi there, where should I put these code,
> Another thing I am looking global IP address
>
> Any idea?[color=green]
>>-----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" <anonymous@discussions.microsoft.com> wrote in[/color]
> message[color=green]
>>news:121001c4e725$e70d47f0$a301280a@phx.gbl...
>>Hi, how to find IP address. Thanks
>>
>>
>>.
>>[/color][/color]


Nov 21 '05 #4

Shiva
P: n/a
Shiva
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'?

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

Any idea?[color=blue]
>-----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" <anonymous@discussions.microsoft.com> wrote in[/color]
message[color=blue]
>news:121001c4e725$e70d47f0$a301280a@phx.gbl...
>Hi, how to find IP address. Thanks
>
>
>.
>[/color]


Nov 21 '05 #5

Herfried K. Wagner [MVP]
P: n/a
Herfried K. Wagner [MVP]
"Souljaz" <anonymous@discussions.microsoft.com> schrieb:[color=blue]
> how to find IP address.[/color]

<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
[color=blue]
>-----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
>
>
><anonymous@discussions.microsoft.com>[color=green]
>> Hi there, where should I put these code,
>> Another thing I am looking global IP address
>>
>> Any idea?[color=darkred]
>>>-----Original Message-----
>>>IP Address of the local machine? If yes, this is one[/color][/color][/color]
way:[color=blue][color=green][color=darkred]
>>>
>>>Dim local As IPHostEntry = Dns.Resolve(Dns.GetHostName[/color][/color][/color]
())[color=blue][color=green][color=darkred]
>>>For ip As IPAddress In local
>>> Console.WriteLine (ip)
>>>Next
>>>
>>>Hope this helps.
>>>
>>>"Souljaz" <anonymous@discussions.microsoft.com> wrote[/color][/color][/color]
in[color=blue][color=green]
>> message[color=darkred]
>>>news:121001c4e725$e70d47f0$a301280a@phx.gbl.. .
>>>Hi, how to find IP address. Thanks
>>>
>>>
>>>.
>>>[/color][/color]
>
>
>.
>[/color]
Nov 21 '05 #7

Cor Ligthert
P: n/a
Cor Ligthert
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[color=blue]
>-----Original Message-----
>Hi,
>
>I have no dynamic IP adress provided by the ISP, however[/color]
is that not the[color=blue]
>same?
>
>When you have more Ip adresses I would look at the code[/color]
that Shiva provided.[color=blue]
>
>Cor
>
>
>.
>[/color]
Nov 21 '05 #9

Cor Ligthert
P: n/a
Cor Ligthert
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

<anonymous@discussions.microsoft.com>
[color=blue]
> 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[color=green]
>>-----Original Message-----
>>Hi,
>>
>>I have no dynamic IP adress provided by the ISP, however[/color]
> is that not the[color=green]
>>same?
>>
>>When you have more Ip adresses I would look at the code[/color]
> that Shiva provided.[color=green]
>>
>>Cor
>>
>>
>>.
>>[/color][/color]


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?
[color=blue]
>-----Original Message-----
>Import the System.Net namespace and this should work[/color]
from any module/class.[color=blue]
>You might want to index (like local(0)) the array[/color]
returned from[color=blue]
>Dns.Resolve() to access the specific address for your[/color]
processing.[color=blue]
>
>Can you give more info on what you mean by 'global ip[/color]
address'?[color=blue]
>
><anonymous@discussions.microsoft.com> wrote in message
>news:17ec01c4e736$dc5f9b80$a401280a@phx.gbl...
>Hi there, where should I put these code,
>Another thing I am looking global IP address
>
>Any idea?[color=green]
>>-----Original Message-----
>>IP Address of the local machine? If yes, this is one[/color][/color]
way:[color=blue][color=green]
>>
>>Dim local As IPHostEntry = Dns.Resolve(Dns.GetHostName[/color][/color]
())[color=blue][color=green]
>>For ip As IPAddress In local
>> Console.WriteLine (ip)
>>Next
>>
>>Hope this helps.
>>
>>"Souljaz" <anonymous@discussions.microsoft.com> wrote in[/color]
>message[color=green]
>>news:121001c4e725$e70d47f0$a301280a@phx.gbl...
>>Hi, how to find IP address. Thanks
>>
>>
>>.
>>[/color]
>
>
>.
>[/color]
Nov 21 '05 #11

Shiva
P: n/a
Shiva
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

<anonymous@discussions.microsoft.com> wrote in message
news:1a3f01c4e77b$0de87bb0$a401280a@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?
[color=blue]
>-----Original Message-----
>Import the System.Net namespace and this should work[/color]
from any module/class.[color=blue]
>You might want to index (like local(0)) the array[/color]
returned from[color=blue]
>Dns.Resolve() to access the specific address for your[/color]
processing.[color=blue]
>
>Can you give more info on what you mean by 'global ip[/color]
address'?[color=blue]
>
><anonymous@discussions.microsoft.com> wrote in message
>news:17ec01c4e736$dc5f9b80$a401280a@phx.gbl...
>Hi there, where should I put these code,
>Another thing I am looking global IP address
>
>Any idea?[color=green]
>>-----Original Message-----
>>IP Address of the local machine? If yes, this is one[/color][/color]
way:[color=blue][color=green]
>>
>>Dim local As IPHostEntry = Dns.Resolve(Dns.GetHostName[/color][/color]
())[color=blue][color=green]
>>For ip As IPAddress In local
>> Console.WriteLine (ip)
>>Next
>>
>>Hope this helps.
>>
>>"Souljaz" <anonymous@discussions.microsoft.com> wrote in[/color]
>message[color=green]
>>news:121001c4e725$e70d47f0$a301280a@phx.gbl...
>>Hi, how to find IP address. Thanks
>>
>>
>>.
>>[/color]
>
>
>.
>[/color]


Nov 21 '05 #12

Noozer
P: n/a
Noozer
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.

<anonymous@discussions.microsoft.com> wrote in message
news:0de701c4e758$1d18a830$a501280a@phx.gbl...[color=blue]
> 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
>[color=green]
> >-----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
> >
> >
> ><anonymous@discussions.microsoft.com>[color=darkred]
> >> 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[/color][/color]
> way:[color=green][color=darkred]
> >>>
> >>>Dim local As IPHostEntry = Dns.Resolve(Dns.GetHostName[/color][/color]
> ())[color=green][color=darkred]
> >>>For ip As IPAddress In local
> >>> Console.WriteLine (ip)
> >>>Next
> >>>
> >>>Hope this helps.
> >>>
> >>>"Souljaz" <anonymous@discussions.microsoft.com> wrote[/color][/color]
> in[color=green][color=darkred]
> >> message
> >>>news:121001c4e725$e70d47f0$a301280a@phx.gbl.. .
> >>>Hi, how to find IP address. Thanks
> >>>
> >>>
> >>>.
> >>>[/color]
> >
> >
> >.
> >[/color][/color]


Nov 21 '05 #13

Post your reply

Help answer this question



Didn't find the answer to your Visual Basic .NET question?

You can also browse similar questions: Visual Basic .NET