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

andu undo at cloud9.net
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 yahoo.com) or for an arbitrary address in
> your LAN subnet?

Yes.

> 
> > What exactly are you opening the
> > socket to
> 
> Broadcast.  I could have chosen some other address, such as the one
> for yahoo.com that Sarah's script used.  (I have a vague hope that
> on a multihomed system 255.255.255.255 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 yahoo.com 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.

<snip>

> Dar Scott
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution

-- 
____________________
Regards, Andu Novac



More information about the use-livecode mailing list