Thema: Delphi Ping und Daten Verwerten

Einzelnen Beitrag anzeigen

Kalfany

Registriert seit: 28. Feb 2008
Ort: München
153 Beiträge
 
Delphi 2007 Professional
 
#24

Re: Ping und Daten Verwerten

  Alt 5. Aug 2008, 16:07
Delphi-Quellcode:
  IdIcmpClient.Host := Host;
  IdIcmpClient.TTL := TTL; //Time to live
  IdIcmpClient.ReceiveTimeout := 5000;
  IdIcmpClient.Ping;
  case IdIcmpClient.ReplyStatus.ReplyStatusType of
    rsEcho:
      begin
        lbLog.Items.Append(format('response from host %s in %d millisec.',
        [IdIcmpClient.ReplyStatus.FromIpAddress,
        IdIcmpClient.ReplyStatus.MsRoundTripTime]));
        result := true;
      end;
    rsError:
      lbLog.Items.Append('Unknown error.');
    rsTimeOut:
      lbLog.Items.Append('Timed out.');
    rsErrorUnreachable:
      lbLog.Items.Append(format('Host %s reports destination network unreachable.',
      [IdIcmpClient.ReplyStatus.FromIpAddress]));
    rsErrorTTLExceeded:
      lbLog.Items.Append(format('Hope %d %s: TTL expired.',
      [IdIcmpClient.TTL, IdIcmpClient.ReplyStatus.FromIpAddress]));
  end; // case
Quelle: delphi-treff.de
  Mit Zitat antworten Zitat