Código Delphi
[-]
function InternetConnected:Boolean;
function LocalIP:string;
var
phe : PHostEnt;
pptr : PaPInAddr;
Buffer : array [0..63] of char;
I : Integer;
GInitData : TWSADATA;
begin
WSAStartup($101, GInitData);
Result := '';
GetHostName(Buffer, SizeOf(Buffer));
phe :=GetHostByName(buffer);
if phe = nil then
begin
Exit;
end;
pptr := PaPInAddr(Phe^.h_addr_list);
I := 0;
while pptr^[i] <> nil do
begin
Application.ProcessMessages;
result:=StrPas(inet_ntoa(pptr^[i]^));
Inc(I);
end;
WSACleanup;
end;
var
S:string;
begin
S:=Copy(LocalIP,1,3);
Result:=(S < '255') and (S > '127');
end;
Esta funsión ami me funciona espero que te sea de utilidad