[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] method to get local IP address on Windows
Beautiful.
> On 22 Sep 2015, at 17:41, Tim Walters <walters@xxxxxxxxxxxxxxxxxx> wrote:
>
> This will work on Mac, and on any Unix system with Python installed:
>
> (
> var pythonStatements = [
> "from socket import gethostname, gethostbyname",
> "print gethostbyname(gethostname())"
> ];
> var cmd = "python -c \"" ++ pythonStatements.join("; ") ++ "\"";
> var ipaddr = cmd.unixCmdGetStdOut.stripWhiteSpace;
> ipaddr.postln;
> )
>
> On 9/22/15 8:16 AM, Fredrik Olofsson wrote:
>> hi Eli,
>> good try, but hardcoding en1 here won't work on all systems…
>>
>>> index = string.find("en1:")+3;
>> so on my macbook pro with no ethernet port (osx 10.10.5, connected to the net via wifi) i need to change it to...
>> index = string.find("en0:")+3;
>> then it works.
>>
>> so perhaps iterate over all available ’en' interfaces? or better find all ’inet ’ (note the extra space) skipping over 127.0.0.1. seems safer.
>>
>> also tried your code on debian wheezy (beaglebone black, connected to the net via usb wifi adapter). it worked but again, wlan0 sometimes can be wlan1 etc.
>>
>> _f
>>
>> #|
>> fredrikolofsson.com musicalfieldsforever.com
>> |#
>>
>>
>> _______________________________________________
>> sc-users mailing list
>>
>> info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
>> archive: https://listarc.bham.ac.uk/marchives/sc-users/
>> search: https://listarc.bham.ac.uk/lists/sc-users/search/
>
>
> _______________________________________________
> sc-users mailing list
>
> info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
> archive: https://listarc.bham.ac.uk/marchives/sc-users/
> search: https://listarc.bham.ac.uk/lists/sc-users/search/
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/