Hi all. MacOS only for now.
I think I put together a way to tell if the default network has changed since the last time an internet connection took place. It's no good of course, just getting the IP address, as given an identical subnet, you have a 1 in 254 change of getting the same IP address on a different network. We want to be absolutely certain. Similarly, the gateway, subnet mask and DNS might also be identical. Finally, the only adapter we care about is the one that is being used as the default route to the internet or local resources. (there may be more than one active adapter, as in the Ethernet and Wireless adapters). The trick is to get the MAC address of the router, then store it and compare it each time you attempt to communicate. Here's what I came up with. Feel free to chide me if I am overthinking this: on mouseUp put "route get default" into tShellCommand put shell(tShellCommand) into tDefaultAdapter put lineOffset("Interface: ", tDefaultAdapter) into tInterfaceLine if tInterfaceLine = 0 then answer info "No default interface found!" as sheet exit mouseUp end if put word 2 of line tInterfaceLine of tDefaultAdapter into tDefaultInterface put "ipconfig getpacket " & tDefaultInterface into tShellCommand put shell(tShellCommand) into tInterfaceDetail put lineOffset("router (ip_mult): ", tInterfaceDetail) into tRouterLine put word 3 of line tRouterLine of tInterfaceDetail into tRouterAddress put char 2 to -2 of tRouterAddress into tRouterAddress put tRouterAddress put "arp " & tRouterAddress into tShellCommand put shell(tShellCommand) into tArpReply put word 4 of tArpReply into tDefaultMACAddress end mouseUp Bob S _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode