Discussion:
[Synalist] How to find the Local IP ?
Daniel Simoes de Ameida
2009-05-12 19:59:36 UTC
Permalink
Hi All,

Is there some hint to find the Local IP (internal network IP of a machine) on a cross-plataform environment ?

I'm using Lazarus (FPC) on Win32 and Linux

I need some think like, IPCONFIG (Win32) and IFCONFIG (Linux) does....

[]s Daniel

Conheça o Projeto ACBr - Automaçao Comercial Brasil
DJSystem a Loja Patrocinadora do ACBr


Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com
Wily Dev
2009-05-12 20:24:36 UTC
Permalink
Hint: GetLocalIPs() in the synamisc unit
Daniel Simoes de Ameida
2009-05-13 01:23:44 UTC
Permalink
Hi Wily,

Tanks for reply... It's incredible easy :)

I was trying to build a function likes GetLocalIPs... but it already exist :) Next time I will do a better search on Documentation...

I use SynaSer for a long time... but Synapse is new for me... I'm changing my Kylix/CLX applications for Lazarus FPC, and on this process, I decide change all Indy Components dependencies for Synapse Library

[]s Daniel

Conheça o Projeto ACBr - Automaçao Comercial Brasil
DJSystem a Loja Patrocinadora do ACBr





________________________________
De: Wily Dev <***@optonline.net>
Para: Ararat Synapse <synalist-***@lists.sourceforge.net>
Enviadas: Terça-feira, 12 de Maio de 2009 17:24:36
Assunto: Re: [Synalist] How to find the Local IP ?


Hint: GetLocalIPs()
in the synamisc unit


Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com
Wily Dev
2009-05-13 02:03:58 UTC
Permalink
You're welcome Daniel.

>> It's incredible easy :) <<

Isn't it nice when that happens? J

Good luck with your project. You'll probably like Synapse too.
Bogusław Brandys
2009-05-13 07:13:36 UTC
Permalink
Wily Dev wrote:
>
> You're welcome Daniel.
>
>> > It's incredible easy :) <<
>
> Isn't it nice when that happens? J
>
> Good luck with your project. You'll probably like Synapse too.
>
>
>

I have similar problem but I'd like to get external ip address. Is it
possible ? It has to be because windows shows me that IP address in
connection details (ADLS connection)

Boguslaw
Markku Uttula
2009-05-13 09:22:09 UTC
Permalink
Bogus?aw Brandys wrote:
> I have similar problem but I'd like to get external ip address. Is it
> possible ? It has to be because windows shows me that IP address in
> connection details (ADLS connection)

I don't think there is a standard way to find this out programmatically
from the machine (the ADSL-router of course has it's own ways of finding
this out) so propably the best bet is to do a http-query to
www.whatismyip.com and parsing the server's output for "Your IP Address
is xxx.xxx.xxx.xxx".

--
Markku Uttula
Veli BOZATLI
2009-05-13 09:29:29 UTC
Permalink
I absolutely agree with Markku.


On Wed, May 13, 2009 at 12:22 PM, Markku Uttula <***@disconova.com
> wrote:

> Bogus?aw Brandys wrote:
> > I have similar problem but I'd like to get external ip address. Is it
> > possible ? It has to be because windows shows me that IP address in
> > connection details (ADLS connection)
>
> I don't think there is a standard way to find this out programmatically
> from the machine (the ADSL-router of course has it's own ways of finding
> this out) so propably the best bet is to do a http-query to
> www.whatismyip.com and parsing the server's output for "Your IP Address
> is xxx.xxx.xxx.xxx".
>
> --
> Markku Uttula
>
>
>
> ------------------------------------------------------------------------------
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK
> i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com
> _______________________________________________
> synalist-public mailing list
> synalist-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/synalist-public
>
CubicDesign
2009-05-13 09:45:43 UTC
Permalink
>I have similar problem but I'd like to get external ip address.


"Get My IP" ( http://soft.tahionic.com/download-get_my_ip/index.html )
uses this web site to get the external IP: checkip.dyndns.org
All you need to do is to read the string in that page and cut the
"Current IP Address:" part.








Markku Uttula wrote:
> Bogus?aw Brandys wrote:
>
>> I have similar problem but I'd like to get external ip address. Is it
>> possible ? It has to be because windows shows me that IP address in
>> connection details (ADLS connection)
>>
>
> I don't think there is a standard way to find this out programmatically
> from the machine (the ADSL-router of course has it's own ways of finding
> this out) so propably the best bet is to do a http-query to
> www.whatismyip.com and parsing the server's output for "Your IP Address
> is xxx.xxx.xxx.xxx".
>
>
Veli BOZATLI
2009-05-13 09:58:48 UTC
Permalink
For Delphi :
http://www.swissdelphicenter.ch/torry/showcode.php?id=1013
http://www.swissdelphicenter.ch/torry/showcode.php?id=965


On Wed, May 13, 2009 at 12:45 PM, CubicDesign <***@gmail.com> wrote:

> >I have similar problem but I'd like to get external ip address.
>
>
> "Get My IP" ( http://soft.tahionic.com/download-get_my_ip/index.html )
> uses this web site to get the external IP: checkip.dyndns.org
> All you need to do is to read the string in that page and cut the "Current
> IP Address:" part.
>
>
>
>
>
>
>
>
> Markku Uttula wrote:
>
> Bogus?aw Brandys wrote:
>
>
> I have similar problem but I'd like to get external ip address. Is it
> possible ? It has to be because windows shows me that IP address in
> connection details (ADLS connection)
>
>
> I don't think there is a standard way to find this out programmatically
> from the machine (the ADSL-router of course has it's own ways of finding
> this out) so propably the best bet is to do a http-query to www.whatismyip.com and parsing the server's output for "Your IP Address
> is xxx.xxx.xxx.xxx".
>
>
>
>
>
> ------------------------------------------------------------------------------
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK
> i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com
> _______________________________________________
> synalist-public mailing list
> synalist-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/synalist-public
>
>
Markku Uttula
2009-05-13 11:06:44 UTC
Permalink
CubicDesign wrote:
> "Get My IP" ( http://soft.tahionic.com/download-get_my_ip/index.html
> ) uses this web site to get the external IP: checkip.dyndns.org All
> you need to do is to read the string in that page and cut the
> "Current IP Address:" part.


Actually, dyndns's ip-checker is propably even better than the one I
suggested - because the address is part of the "standard" dynamic
nameservice protocol (ok, it is only a de facto-standard, but anyway)
and thus they propably won't be changing the servers response in the
near future (unlike whatismyip.com that has added lots of unnecessary
junk to their page - most likely to cover the expenses they are facing
when everyone keeps checking their IP through their service).


Veli BOZATLI wrote:
> For Delphi :
> http://www.swissdelphicenter.ch/torry/showcode.php?id=1013
> http://www.swissdelphicenter.ch/torry/showcode.php?id=965

Oh please... we're on a Synapse board. Why offer something "non-Synapse"
as a solution? :-p

In theory (since I don't have Delphi here to try this with) with Synapse
this should be something as simple as:

program GetExternalIP;

{$APPTYPE CONSOLE}

uses
classes, httpsend;

var
Response: TStringList;

begin
Response := TStringList.create;
try
if not HttpGetText('http://checkip.dyndns.org/', Response) then
Writeln('Unable to get external IP.')
else
Writeln(Response.Text); // Parse this for the IP...
finally
Response.Free;
end;
end.

--
Markku Uttula
Lee Jenkins
2009-05-13 11:53:42 UTC
Permalink
Markku Uttula wrote:
> Bogus?aw Brandys wrote:
>> I have similar problem but I'd like to get external ip address. Is it
>> possible ? It has to be because windows shows me that IP address in
>> connection details (ADLS connection)
>
> I don't think there is a standard way to find this out programmatically
> from the machine (the ADSL-router of course has it's own ways of finding
> this out) so propably the best bet is to do a http-query to
> www.whatismyip.com and parsing the server's output for "Your IP Address
> is xxx.xxx.xxx.xxx".
>

Also don't forget ipchicken.com for IP resolution similar to whatismyip.com.

--
Warm Regards,

Lee
Lukas Gebauer
2009-05-13 11:54:34 UTC
Permalink
> I have similar problem but I'd like to get external ip address. Is it
> possible ? It has to be because windows shows me that IP address in
> connection details (ADLS connection)

For TCP/IP exists only local IP address.
Robin Cumming
2009-05-13 06:59:19 UTC
Permalink
I found this reference to freepascal, seems to use Indy
components to get IP of machine. Hope it helps.

http://forum.lazarus.freepascal.org/index.php?PHPSESSID=63e2b0db191c4912f8e5f8c81defea65&/topic,6098.0.html

Rob

> Date: Tue, 12 May 2009 12:59:36 -0700 (PDT)
> From: Daniel Simoes de Ameida <***@yahoo.com.br>
> Subject: [Synalist] How to find the Local IP ?
> To: Ararat Synapse
> <synalist-***@lists.sourceforge.net>
> Message-ID: <***@web54410.mail.yahoo.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi All,
>
> Is there some hint to find the Local IP (internal network
> IP of a machine) on a cross-plataform environment ?
>
> I'm using Lazarus (FPC) on Win32 and Linux
>
> I need some think like, IPCONFIG (Win32) and IFCONFIG
> (Linux) does....
>
> []s Daniel
>


_______________________________________________________________________________________
“EAST RAND SECURITY EXPO NOW ON”


http://www.swiftsms.co.za/swiftT/track.asp?e=*em*&cid=113&u=8&tid=2011
Robin Cumming
2009-05-13 07:02:13 UTC
Permalink
Sorry, bad morning, link should be :

http://forum.lazarus.freepascal.org/index.php/topic,6098.0.html

> I found this reference to freepascal, seems to use Indy
> components to get IP of machine. Hope it helps.
>
>
http://forum.lazarus.freepascal.org/index.php?PHPSESSID=63e2b0db191c4912f8e5f8c81defea65&/topic,6098.0.html
>
> Rob
>
> > Date: Tue, 12 May 2009 12:59:36 -0700 (PDT)
> > From: Daniel Simoes de Ameida <***@yahoo.com.br>
> > Subject: [Synalist] How to find the Local IP ?
> > To: Ararat Synapse
> > <synalist-***@lists.sourceforge.net>
> > Message-ID: <***@web54410.mail.yahoo.com>
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > Hi All,
> >
> > Is there some hint to find the Local IP (internal
> network
> > IP of a machine) on a cross-plataform environment ?
> >
> > I'm using Lazarus (FPC) on Win32 and Linux
> >
> > I need some think like, IPCONFIG (Win32) and IFCONFIG
> > (Linux) does....
> >
> > []s Daniel
> >
>
>
>
_______________________________________________________________________________________
> “EAST RAND SECURITY EXPO NOW ON”
>
>
>
http://www.swiftsms.co.za/swiftT/track.asp?e=*em*&cid=113&u=8&tid=2011
>
>
>



_______________________________________________________________________________________
“EAST RAND SECURITY EXPO NOW ON”


http://www.swiftsms.co.za/swiftT/track.asp?e=*em*&cid=113&u=8&tid=2011
a***@emailaya.com
2009-05-13 09:41:37 UTC
Permalink
am i the only one to receive 127.0.0.1 as the result from this function?


Original Message:
-----------------
From: Wily Dev ***@optonline.net
Date: Tue, 12 May 2009 22:03:58 -0400
To: synalist-***@lists.sourceforge.net
Subject: Re: [Synalist] Res: How to find the Local IP ?


You're welcome Daniel.

>> It's incredible easy :) <<

Isn't it nice when that happens? J

Good luck with your project. You'll probably like Synapse too.



--------------------------------------------------------------------
myhosting.com - Premium Microsoft® Windows® and Linux web and application
hosting - http://link.myhosting.com/myhosting
Wily Dev
2009-05-13 15:33:22 UTC
Permalink
And of course, if you run any of your own servers, you could provide
"external IP reporting" in all sorts of ways...
amos
2009-05-13 16:01:10 UTC
Permalink
i think my reply got lost among the other replies: am i the only one to get 127.0.0.1 as a result from GetLocalIPs function?

thanks









On 13/05/2009 18:33:22, Wily Dev - ***@optonline.net wrote:

And of course, if you run any of your own servers, you could provide

"external IP reporting" in all sorts of ways...





------------------------------------------------------------------------------

The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your

production scanning environment may not be a perfect world - but thanks to

Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700

Series Scanner you'll get full speed at 300 dpi even with all image

processing features enabled. http://p.sf.net/sfu/kodak-com

_______________________________________________

synalist-public mailing list

synalist-***@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/synalist-public
Wily Dev
2009-05-13 16:45:41 UTC
Permalink
-- am i the only one to get 127.0.0.1 as a result from GetLocalIPs
function?

Yes.
amos
2009-05-13 16:56:20 UTC
Permalink
i dont even have a router... so how can i make this function return the IP and not 127.0.0.1?









On 13/05/2009 19:45:41, Wily Dev - ***@optonline.net wrote:



-- am i the only one to get 127.0.0.1 as a result from GetLocalIPs function?



Yes.
Wily Dev
2009-05-13 18:19:18 UTC
Permalink
I don't know.

Being that you're the only one reporting this problem, it may be best to
step through the code and see what's going on...

Possible first things to check: Did someone actually set the IP address on
that machine to be the loopback address??
Does the code work correctly on other
machines? It does for us.
Loading...