[PD] get my ip

Marc Lavallée odradek at videotron.ca
Sun Feb 1 18:28:15 CET 2004


On Mon, Feb 02, 2004 at 01:25:56AM -0600, Eric Skogen wrote:
> >> Now for the real challenge:  write a script that works on all of 
> the  platforms that Pd does.  ;)
> 
> maybe use thomas grill's python extern and something like: 
> |gethostbyname(gethostname()) ?|

This would only give the ip address of the computer, not the ip address of
a specific interface. On my laptop I can use four physical interfaces
(eth0, eth1, wlan0 and ppp0), and its hostname is tied to the local
address (127.0.0.1) because my laptop is not always connected to the
Internet. 

The way to get the different ip addresses is to use specific utilities 
that depends on the operating system; on the Windows platform, there's
ipconfig and netsh, but their output are not consistent and also 
localized, which makes things more difficult. 

So this is a case where a cross-platform external is a better choice than 
a script. (The best choice being to not use Windows at all).

--
Marc




More information about the Pd-list mailing list