Puedes verificar si hay conexión antes de realizar la descarga con este ejemplo de escafandra que vi por el foro.
Código Delphi
[-]
function Ping(Addr: PCHAR; Rep: integer = 3): boolean;
var
WSA: TWSAData;
hIcmpFile: Cardinal;
Reply: ICMP_ECHO_REPLY;
He: Phostent;
n: Integer;
begin
Result:= false;
if WSAStartup(MAKEWORD(1, 1), WSA) <> 0 then exit;
He:= gethostbyname(Addr);
if He = nil then exit;
hIcmpFile:= IcmpCreateFile;
n:= 0;
repeat
Result:= IcmpSendEcho(hIcmpFile, PULONG(He.h_addr_list^)^, 0, 0, 0,
PCHAR(@Reply), sizeof(ICMP_ECHO_REPLY), 1000) <> 0;
if Result then
Result:= Reply.Status = 0;
inc(n);
until Result or (n=3);
IcmpCloseHandle(hIcmpFile);
WSACleanup;
end;
La llamada la puedes hacer de esta manera.
Código Delphi
[-]
if Ping('www.google.com') then
GetInetFile( internetFile, localFilename)
else
...