[Indy10] PING?

Giganews Newsgroups
Subject: [Indy10] PING?
Posted by:  fredtheman (gkdsh0n…@sneakemail.com)
Date: Tue, 3 Jan 2006

Hi

I seem to have installed Indy10 OK, but this code that used to work with the version of Indy that comes with D7 no longer compiles, and I couldn't find what it's been replaced with in Indy10. Does someone know?

[code]
procedure TForm1.Timer1Timer(Sender: TObject);
var
  RepStatus: TReplyStatus;
begin
  //PING host
  IdIcmpClient1.Host := '127.0.0.1';
  IdIcmpClient1.ReceiveTimeout := 2000; //2 seconds
  IdIcmpClient1.Ping;

  //Works in Indy Delphi 7, no longer works in Indy 10
  //"Undeclared identifier: 'ReplyStatus'"
  {
  if IdIcmpClient1.ReplyStatus.ReplyStatusType=rsTimeOut then begin
    Label1.Caption :='Server dead @ ' + TimeToStr(Time);        R
  end else begin
    Label1.Caption :='Server alive @ ' + TimeToStr(Time);
  end;
  }

  //Doesn't work in Indy 10
  //"Undeclared identifier: 'ReplyStatus'"
  {
  if (IDIcmpClient1.ReplyStatus.BytesReceived > 0) then begin
    ShowMessage('Server alive');
  end else begin
    ShowMessage('Server dead');
  end;
  }

  //Doesn't work in Indy 10 : always returns "Unsucessful"
  {
  RepStatus := IDIcmpClient1.Receive(2000);
  if (RepStatus.BytesReceived > 0) then
    Label1.Caption := 'Ping Time: ' + IntToStr(RepStatus.MsRoundTripTime) + ' ms'
  else
    Label1.Caption := 'Ping Unsuccessful';
  }

end;
[/code]

Thank you
Fred.

Replies