Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Dec : Indy 10 Ping

www.cryer.info
Managed Newsgroup Archive

Indy 10 Ping

Subject:Indy 10 Ping
Posted by:"Ira" (ira.weintra..@earthlink.net)
Date:28 Dec 2005 06:40:37

I am trying to implement a simple Ping function to determine if
a computer is connected to a local network.  I am using Delphi
2005 with Indy 10, using the IdIcmpClient.  The reply status
keeps on giving me the same information regardless of whether
the target computer is online or not.  Below is my code.

const
  Btns: TMsgDlgButtons = [mbOK];
var
  RepStatus: TReplyStatus;
begin
  IDIcmpClient1.Host := '192.168.10.100';
  IDIcmpClient1.Ping;
  if (RepStatus.BytesReceived > 0) then
    MessageDlg('Ping Time: ' + IntToStr(RepStatus.MsRoundTripTime) + ' ms',
        mtInformation, Btns, 0)
  else
    MessageDlg('Ping Unsuccessful', mtInformation, Btns, 0);

Replies:

www.cryer.info
Managed Newsgroup Archive