a *fast* check for whether another machine is on the local network?

Dar Scott dsc at swcp.com
Sat Jun 15 19:08:42 EDT 2013


Yeah, a delay might be needed.  Maybe the close socket should be after the delay, too.

I'll check on my system and see what I get with a delay.  

This is a genus idea, Alex, so I hope it works.  And I hope it can move to Windows.

Dar

PS:  I hope the coffee shop or hotel does not automatically blacklist your MAC address.

On Jun 15, 2013, at 4:47 PM, Alex Tweedly wrote:

> Sorry, should have included all that info in case it varies ....
> 
> OS X 10.8.4
> LC 6.0.1 (rc1)
> Some random wifi network in a cafe
> 
> I did something like
>  repeat with i = 1 to 100
>     shell ("ping -c 1 10.0.0." & i)
>  end repeat
> 
> 
> 10.0.0.33 was some random machine (i.e. not me) on the same network
>    (I suspect a better set up wifi network shouldn't have let me see all of them ... ??)
> 
> I did an arp -a
> looked to see what machines were there, picked one, deleted its arp entry (with sudo arp -d 10.0.0.33), and then tried my code
> 
> the arp entry re-appeared with its mac address info - except for one time when it was incomplete. So I added the paranoid wait. With that in place, it always worked, but I can't swear that the wait made the difference, rather than some random event. Couldn't recreate the failure, even without the wait.
> 
> Right now I'm on a different (hotel) network, and can't see any other devices, so can't try it here.
> 
> -- Alex.
> 
> 
> On 15/06/2013 05:08, Dar Scott wrote:
>> OK,  I have been able to remove one entry from the arp table using this:
>> 
>> sudo arp -d 10.20.40.50 inscope en0
>> 
>> The result does not look good.  The mouseUp handler does add an entry to the arp table, but it is marked incomplete instead of having an MAC address.  It does the same for a computer that is available or something bogus.  Maybe I need to add the paranoid line.
>> 
>> Dar
>> 
>> 
>> On Jun 14, 2013, at 5:24 PM, Dar Scott wrote:
>> 
>>> close?
>>> platform?
>>> (looks OK so far on 10.6)
>>> 
>>> And suppose I'm from Missouri.  How do I know it wasn't already there?
>>> 
>>> I tried sudo arp -d -a, but must have done something wrong.  I see no change in arp -a.
>>> 
>>> Dar
>>> 
>>> 
>>> On Jun 14, 2013, at 5:02 PM, Alex Tweedly wrote:
>>> 
>>>> It does. I wondered also, so I tried it out before I posted - actual code below ...
>>>> 
>>>> on mouseup
>>>>  open datagram socket to "10.0.0.33:4000"  -- NB we don't care if this succeeds or not
>>>>  put shell("arp -a") into t
>>>>  put t
>>>> end mouseup
>>>> 
>>>> -- Alex.
>>>> 
>>>> 
>>>> 
>>>> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list