Obtaining ALL local IP addresses for machine

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Obtaining ALL local IP addresses for machine

Post by andyh1234 » Thu Feb 03, 2011 1:21 pm

Hi,

I have a script Mark shared that lets me grab the IP address for the local computer, it works well and grabs the first IP, usually the ethernet connection on the desktop macs, and the airport on the laptops.

However I have a few Macs that have both an ethernet and airport connection enabled and need to be able to get both IP addresses as im interested in communication over the airport/wifi network. Any ideas?

Thanks

Andy

Marks original script was...

function getLocalIPAddress
put "255.255.255.255:44444" into mySock
open datagram socket to mySock
put hostAddress(mySock) into myIP1
close socket mySock
return myIP1
end getLocalIPAddress

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Obtaining ALL local IP addresses for machine

Post by Mark » Sun Feb 13, 2011 12:56 am

Hi Andy,

Use shell("ifconfig -a") and write a script that finds all ip address in the output of this shell command.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

mhoneywill
Posts: 66
Joined: Fri Feb 05, 2010 7:31 pm

Re: Obtaining ALL local IP addresses for machine

Post by mhoneywill » Sun Feb 13, 2011 2:34 pm

I think on windowsXP you need to use the command "ipconfig /all"

Cheers

Martin

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Re: Obtaining ALL local IP addresses for machine

Post by andyh1234 » Sun Feb 13, 2011 3:07 pm

Thanks!

Andy

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Obtaining ALL local IP addresses for machine

Post by Simon » Mon May 07, 2012 2:00 pm

Hi,
ipconfig /all returns a system language specific result;
English: "Physical Address"
French: "Adresse physique"
Is there a way to change my cmd line language so that I can test the different languages I need?

THX,
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply