Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Dec : Re: Delphi Indy 10 TIdIcmpClient

www.cryer.info
Managed Newsgroup Archive

Re: Delphi Indy 10 TIdIcmpClient

Subject:Re: Delphi Indy 10 TIdIcmpClient
Posted by:val..@dk.is
Date:Sun, 24 Dec 2006 17:24:15

Thank you for youīre input, i am now trying to use the TidTraceRoute object
but when i call route.Trace i get a socket error #10013 access denied.
I donīt really under stand this problem because i donīt have a firewall or
virus protection
I tryed to run-->cmd-->tracert google.com
and there it works fine,, do i need administrative rights to call the trace
procedure ?

here is a expample of my code

procedure TFVH69.FormCreate(Sender: TObject);
begin
  inherited;
  route := TIdTraceroute.create(self);
  route.OnReply := TraceRouteReply;
  route.ReceiveTimeout := 200;
  route.ResolveHostNames := true;
  route.Host := '157.157.110.10';
end;


function TFVH69.GetISPName : String;
begin
  route.Trace;
  Application.ProcessMessages;
end;

procedure TFVH69.TraceRouteReply(ASender: TComponent;
const AReplyStatus: TReplyStatus);
var
   sTime,tmps: String;
begin
   if (AReplyStatus.MsRoundTripTime = 0) then
     sTime := '<1'
   else
     sTime := '=';

   tmps := Format('%d bytes from %s ( %s ): icmp_seq=%d   ttl=%d time%s%d ms
msg=%s',
                             [AReplyStatus.BytesReceived,
                              AReplyStatus.FromIpAddress,
                              AReplyStatus.HostName,
                              AReplyStatus.SequenceId,
                              AReplyStatus.TimeToLive,
                              sTime,
                              AReplyStatus.MsRoundTripTime,
                              AReplyStatus.Msg      ]);

   ShowMessage(tmps);
   Application.processmessages;
end;


"Don Siders" <sidersd@att.net> wrote in message
news:458d8b99$1@newsgroups.borland.com...
> >I really need help with this one......
>
>> Changes made in indy 10 seem not to include TTL witch a really need to
>> solve my problem, or if some one out there knows of a better way to
>> resolve this then please be jolly over ther holliday and help me :)
>
>> Here is a sample of my code like i would think this should work on
>> earlier versions of indy
>
> I'm not sure if this satifsfies all your processing requirements. The
> changes in how TIdICMPClient handles ping responses were related to two
> areas:
>
> * multi-threaded pings
> * packet differences between ECHO replies and TTL errors
>
> You'll could use the TIdICMPClient.OnReply event handler to access TTL
> information received in the reponse packets.
>
> It would be easier to use the TIdTraceRoute component
> (.\Core\IdTraceRoute.pas).  It already handles the packet sequencing
> issues, as well as Host IP to Host Name resolution.  Check out the Trace
> and DoReply methods in that unit.
>
> hth...
>
> ---
>
>> function GetIspIP(const HostToTrace : String) : String; var ICMP:
>> TIdIcmpClient; i : Integer; begin result := ''; ICMP :=
>> TIdIcmpClient.Create; ICMP.ReceiveTimeout := 1000; ICMP.Host :=
>> HostToTrace; // for example google.com // the route should first return
>> my ip then router the the isp witch whould have a dns name // and i would
>> like to use that dns name for I := 1 to 20 - 1 do begin ICMP.TTL :=
>> ICMP.TTL; ICMP.Ping; // check if FromIpAddress includes domin.??(?) , not
>> only ip address if HasDnsIncluded(ICMP.ReplyStatus.FromIpAdress) then
>> begin //Extract Domin name result :=
>> ExtractDns(ICMP.ReplyStatus.FromIpAdress); exit; end; end; end;

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive