Re: [Pharo-dev] Getting IP address of machine from Pharo

2018-03-14 Thread Henrik Sperre Johansen
We don't really, hence things like
http://forum.world.st/Pharo-user-Does-SSDP-package-supposed-to-work-on-Pharo-6-td4933677.html

;)

Cheers,
Henry



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html



Re: [Pharo-dev] Getting IP address of machine from Pharo

2018-03-14 Thread Denis Kudriashov
Yes, external lib is an option.
I expected that we already have something in the image.

2018-03-14 11:34 GMT+01:00 Julien :

> Ok, this one you can get it (for each network interface) via
>
> $ ifconfig
>
> In the command line. So I guess it should be possible to ask the OS via a
> FFI call what is the address.
>
> I don’t know what is done in Pharo about that.
>
> Apparently, on Linux using C, it is possible to get the IP address of an
> interface via a call to getifaddrs [1].
>
> I don’t know what is the method to do that on Mac OS.
>
> Julien
>
> Links:
> [1]: http://man7.org/linux/man-pages/man3/getifaddrs.3.html
>
> ---
> Julien Delplanque
> Doctorant à l’Université de Lille 1
> http://juliendelplanque.be/phd.html
> Equipe Rmod, Inria
> Bâtiment B 40, Avenue Halley 59650
> 
>  Villeneuve
> 
>  d'Ascq
> 
> Numéro de téléphone: +333 59 35 86 40 <+33%203%2059%2035%2086%2040>
>
> Le 14 mars 2018 à 11:28, Denis Kudriashov  a écrit :
>
> 2018-03-14 11:14 GMT+01:00 Julien :
>
>> What do you mean by your IP address, on your local network or the one
>> seen by external servers when you connect to them?
>>
>
> I need address in my local network.
>
>
>>
>> If I remember well, the IP address seen by computers outside your local
>> network is not the IP address of your actual computer but the one of the
>> router connecting your local network to the outside web.
>>
>> I am not sure you can get the outside IP address without asking it to a
>> computer outside your local network but I might be wrong.
>>
>> Julien
>>
>> ---
>> Julien Delplanque
>> Doctorant à l’Université de Lille 1
>> http://juliendelplanque.be/phd.html
>> Equipe Rmod, Inria
>> Bâtiment B 40, Avenue Halley 59650
>> 
>>  Villeneuve
>> 
>>  d'Ascq
>> 
>> Numéro de téléphone: +333 59 35 86 40 <+33%203%2059%2035%2086%2040>
>>
>> Le 14 mars 2018 à 11:07, Denis Kudriashov  a écrit
>> :
>>
>> Hello.
>>
>> Do we have a way to retrieve IP address from Pharo?
>> I tried to use following code:
>>
>> NetNameResolver addressForName: NetNameResolver localHostName
>>
>> But it either not works (dialog with retry give-up options) or returns
>> localhost 127.0.0.1.
>>
>> Best regards,
>> Denis
>>
>>
>>
>
>


Re: [Pharo-dev] Getting IP address of machine from Pharo

2018-03-14 Thread Julien
Ok, this one you can get it (for each network interface) via 

$ ifconfig

In the command line. So I guess it should be possible to ask the OS via a FFI 
call what is the address.

I don’t know what is done in Pharo about that.

Apparently, on Linux using C, it is possible to get the IP address of an 
interface via a call to getifaddrs [1].

I don’t know what is the method to do that on Mac OS.

Julien

Links:
[1]: http://man7.org/linux/man-pages/man3/getifaddrs.3.html

---
Julien Delplanque
Doctorant à l’Université de Lille 1
http://juliendelplanque.be/phd.html
Equipe Rmod, Inria
Bâtiment B 40, Avenue Halley 59650 Villeneuve d'Ascq
Numéro de téléphone: +333 59 35 86 40

> Le 14 mars 2018 à 11:28, Denis Kudriashov  a écrit :
> 
> 2018-03-14 11:14 GMT+01:00 Julien  >:
> What do you mean by your IP address, on your local network or the one seen by 
> external servers when you connect to them?
> 
> I need address in my local network.
>  
> 
> If I remember well, the IP address seen by computers outside your local 
> network is not the IP address of your actual computer but the one of the 
> router connecting your local network to the outside web.
> 
> I am not sure you can get the outside IP address without asking it to a 
> computer outside your local network but I might be wrong.
> 
> Julien
> 
> ---
> Julien Delplanque
> Doctorant à l’Université de Lille 1
> http://juliendelplanque.be/phd.html 
> Equipe Rmod, Inria
> Bâtiment B 40, Avenue Halley 59650 
> 
>  Villeneuve 
> 
>  d'Ascq 
> 
> Numéro de téléphone: +333 59 35 86 40 
> 
>> Le 14 mars 2018 à 11:07, Denis Kudriashov > > a écrit :
>> 
>> Hello.
>> 
>> Do we have a way to retrieve IP address from Pharo?
>> I tried to use following code:
>> 
>> NetNameResolver addressForName: NetNameResolver localHostName 
>> 
>> But it either not works (dialog with retry give-up options) or returns 
>> localhost 127.0.0.1.
>> 
>> Best regards,
>> Denis
> 
> 



Re: [Pharo-dev] Getting IP address of machine from Pharo

2018-03-14 Thread Denis Kudriashov
2018-03-14 11:14 GMT+01:00 Julien :

> What do you mean by your IP address, on your local network or the one seen
> by external servers when you connect to them?
>

I need address in my local network.


>
> If I remember well, the IP address seen by computers outside your local
> network is not the IP address of your actual computer but the one of the
> router connecting your local network to the outside web.
>
> I am not sure you can get the outside IP address without asking it to a
> computer outside your local network but I might be wrong.
>
> Julien
>
> ---
> Julien Delplanque
> Doctorant à l’Université de Lille 1
> http://juliendelplanque.be/phd.html
> Equipe Rmod, Inria
> Bâtiment B 40, Avenue Halley 59650
> 
>  Villeneuve
> 
>  d'Ascq
> 
> Numéro de téléphone: +333 59 35 86 40 <+33%203%2059%2035%2086%2040>
>
> Le 14 mars 2018 à 11:07, Denis Kudriashov  a écrit :
>
> Hello.
>
> Do we have a way to retrieve IP address from Pharo?
> I tried to use following code:
>
> NetNameResolver addressForName: NetNameResolver localHostName
>
> But it either not works (dialog with retry give-up options) or returns
> localhost 127.0.0.1.
>
> Best regards,
> Denis
>
>
>


Re: [Pharo-dev] Getting IP address of machine from Pharo

2018-03-14 Thread Benoit St-Jean via Pharo-dev
--- Begin Message ---
This is probably what you are looking for (one of the code snippets does 
exactly what you want).
http://forum.world.st/Figuring-out-external-IP-addresses-of-network-interfaces-td4937291.html
As for services/websites you can query to get the public ip address, here's a 
short list (you'll have to modify the example above to parse the response 
correctly):
http://checkip.dyndns.com
https://www.whatismypublicip.com/
http://freegeoip.net
https://who.is/
http://www.ipchicken.com/
http://www.whatsmyip.org/
https://api.ipify.org/
https://whatismyipaddress.com/

IMHO, the simplest is api.ipify.org.  However, note that some of those service 
also answer geolocation info!


- 
Benoît St-Jean 
Yahoo! Messenger: bstjean 
Twitter: @BenLeChialeux 
Pinterest: benoitstjean 
Instagram: Chef_Benito
IRC: lamneth 
Blogue: endormitoire.wordpress.com 
"A standpoint is an intellectual horizon of radius zero".  (A. Einstein) 

On Wednesday, March 14, 2018, 6:08:41 AM EDT, Denis Kudriashov 
 wrote:  
 
 Hello.
Do we have a way to retrieve IP address from Pharo?I tried to use following 
code:


NetNameResolver addressForName: NetNameResolver localHostName 


But it either not works (dialog with retry give-up options) or returns 
localhost 127.0.0.1.
Best regards,Denis  --- End Message ---


Re: [Pharo-dev] Getting IP address of machine from Pharo

2018-03-14 Thread Julien
What do you mean by your IP address, on your local network or the one seen by 
external servers when you connect to them?

If I remember well, the IP address seen by computers outside your local network 
is not the IP address of your actual computer but the one of the router 
connecting your local network to the outside web.

I am not sure you can get the outside IP address without asking it to a 
computer outside your local network but I might be wrong.

Julien

---
Julien Delplanque
Doctorant à l’Université de Lille 1
http://juliendelplanque.be/phd.html
Equipe Rmod, Inria
Bâtiment B 40, Avenue Halley 59650 Villeneuve d'Ascq
Numéro de téléphone: +333 59 35 86 40

> Le 14 mars 2018 à 11:07, Denis Kudriashov  a écrit :
> 
> Hello.
> 
> Do we have a way to retrieve IP address from Pharo?
> I tried to use following code:
> 
> NetNameResolver addressForName: NetNameResolver localHostName 
> 
> But it either not works (dialog with retry give-up options) or returns 
> localhost 127.0.0.1.
> 
> Best regards,
> Denis