I have written a tiny function which detects on a Mac if any network connection is available.
This function relies on the availability of a nameserver (DNS) which under normal circumstances should be available.
Alternatives I have seen so far, either ping Google.com (irrelevant for a network without Internet access) or use specific Reachability functions (Cocoa) functions, which are pretty tricky to implement [in Lazarus Pascal].
In this case we will find out if the Mac has any kind of network connection (WiFi, Ethernet, Bluetooth, 3G, etc).
But it will NOT tell you if there is an Internet connection, it will just detect if there is a network connection.
This function returns TRUE (there is a network available) of FALSE (there is NO network available).
Please add "Process" to your Uses clause.
function FoundNetwork:boolean;
var s:ansistring;
begin
RunCommand('/usr/sbin/scutil',['--dns'],s);
FoundNetwork:= pos('nameserver',s)>0;
end;