Getting the local IP address! (was Re: Scanning machines on a network)

andu undo at
Fri Mar 15 03:23:01 EST 2002

Dar Scott wrote:
> On Thursday, March 14, 2002, at 11:03 PM, andu wrote:
> > On Linux as expected it doesn't work.
> Actually, I naively thought it would.  Does it work for an Internet
> address (such as that for or for an arbitrary address in
> your LAN subnet?


> > What exactly are you opening the
> > socket to
> Broadcast.  I could have chosen some other address, such as the one
> for that Sarah's script used.  (I have a vague hope that
> on a multihomed system would get the primary IP
> address, but I have no real reason to think this.  Also, I prefer a
> method that would work even on a LAN without Internet access.
> Using a valid Internet IP address on a multihomed system will
> probably get the address for an adaptor with Internet access.)

Ipconfig on windows, ifconfig on Linux with the shell() function should
be most reliable.

> > and what good would that ip address be if you're not networked
> > as you imply
> Whoops.  I didn't mean to imply that.  Sarah's method depends on
> being connected to the Internet.  I didn't want to be limited to
> that.  Another advantage of not making a connection is related to
> manners; I was not comfortable with connecting to to find
> out my IP address.  (For me it is also a matter of security; I
> don't want computers on some of my systems babbling more than they
> need to.)

Connecting to your router should do, then. The idea is that if you don't
want to or can't use built-in tools like ipconfig/ifconfig (must be some
way for Mac too) you must use some external reference point to find out
the IP address.


> Dar Scott
> _______________________________________________
> use-revolution mailing list
> use-revolution at

Regards, Andu Novac

More information about the use-livecode mailing list