Connecting Tech Pros Worldwide Help | Site Map

Find IP Address

Souljaz
Guest
 
Posts: n/a
#1: Nov 21 '05
Hi, how to find IP address. Thanks
Shiva
Guest
 
Posts: n/a
#2: Nov 21 '05

re: Find IP Address


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


Guest
 
Posts: n/a
#3: Nov 21 '05

re: Find IP Address


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]
Cor Ligthert
Guest
 
Posts: n/a
#4: Nov 21 '05

re: Find IP Address


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]


Shiva
Guest
 
Posts: n/a
#5: Nov 21 '05

re: Find IP Address


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]


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#6: Nov 21 '05

re: Find IP Address


"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/>
Guest
 
Posts: n/a
#7: Nov 21 '05

re: Find IP Address


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]
Cor Ligthert
Guest
 
Posts: n/a
#8: Nov 21 '05

re: Find IP Address


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


Guest
 
Posts: n/a
#9: Nov 21 '05

re: Find IP Address


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]
Cor Ligthert
Guest
 
Posts: n/a
#10: Nov 21 '05

re: Find IP Address


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]


Guest
 
Posts: n/a
#11: Nov 21 '05

re: Find IP Address


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]
Shiva
Guest
 
Posts: n/a
#12: Nov 21 '05

re: Find IP Address


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]


Noozer
Guest
 
Posts: n/a
#13: Nov 21 '05

re: Find IP Address


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]


Closed Thread


Similar Visual Basic .NET bytes