There Is Function That Detect If Internet Is Connected ?

Giganews Newsgroups
Subject: There Is Function That Detect If Internet Is Connected ?
Posted by:  Avi Jackobson (omerso…@inter.net.il)
Date: Tue, 7 Jul 2009

Hello ,

using d7 and indy10 components.

There Is Ready Function That Detect If Internet Is Connected ?

by made a self function that connect some smtp server without send the message,

will be enough ?

Sample

function internet_Connected : Boolean;
begin
  Result := False;

  SMTP.Host := SmtpServerName; // host Smtp.Gmail.Com.
  .
  .
  try

    try
      SMTP.Connect;
    //  SMTP.Send(idmessage); <- this also require ?
    except
    on E: EIdSMTPReplyError do
    begin
    // ShowMessage(E.Message);
    end;
  end;

  finally
    Result := SMTP.Connected;
    if Result
      then SMTP.Disconnect;
  end;
end;

TIA

Avi Jackobson

Replies