a *fast* check for whether another machine is on the local network?
Alex Tweedly
alex at tweedly.net
Sat Jun 15 18:47:45 EDT 2013
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.
>>>
>>>
>>>
>>>
More information about the use-livecode
mailing list