Thema: Delphi [Indy] Pingen

Einzelnen Beitrag anzeigen

Klaus01

Registriert seit: 30. Nov 2005
Ort: München
5.771 Beiträge
 
Delphi 10.4 Sydney
 
#2

Re: [Indy] Pingen

  Alt 13. Mär 2006, 19:29
Wenn man sich den Quellcode vom idcmp anschaut, scheint das so gewollt zu sein:

Delphi-Quellcode:
function TIdIcmpClient.Receive(ATimeOut: Integer): TReplyStatus;
var
  BytesRead : Integer;
  Size : Integer;
  StartTime: Cardinal;
begin
  FillChar(bufReceive, sizeOf(bufReceive),0);
  Size := sizeof(bufReceive);
  StartTime := GetTickCount;
  repeat
    BytesRead := ReceiveBuffer(bufReceive, Size, ATimeOut);
    GStack.CheckForSocketError(BytesRead);
    if DecodeResponse(BytesRead, Result) then
    begin
      break
    end
    else
    begin
      // The received reply wasn't for this request, so make sure we don't
      // report it as such in case we time out after this
      result.BytesReceived := 0;
      result.FromIpAddress := '0.0.0.0'; {Do not Localize}  {<----------------------------------------}
      result.MsgType := 0;
      result.SequenceId := wSeqNo;
      result.TimeToLive := 0;
      result.ReplyStatusType := rsTimeOut;

      ATimeOut := Cardinal(ATimeOut) - GetTickDiff(StartTime,getTickCount); // compute new timeout value
    end;
  until ATimeOut <= 0;
end;
Grüße
Klaus
Klaus
  Mit Zitat antworten Zitat