Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Feb : Re: Traceroute functions
| Subject: | Re: Traceroute functions |
| Posted by: | "Ryan" (nospam@nospam.nospam) |
| Date: | Mon, 26 Feb 2007 13:17:28 |
Another update:
I had a mixed version of Indy installed - ie; I'd 'installed 10.0.52' but
incorrectly. I've cleaned out delphi of all Indy references and reinstalled
the new one.
TTL now works. In other words, in Delphi 2006 as shipped, the version of
Indy they use does have a broken TTL property. Installing 10.0.52 (properly
duh) fixed this! Hope that helps someone out there with a similar problem!
"Ryan" <nospam@nospam.nospam> wrote in message
news:45ddcb63@newsgroups.borland.com...
> Update: I managed to get the traceroute working, but I had to use icmp.dll
> directly from the pascal header files.
> It works fine, so I'm starting to wonder if there's a bug with the Indy
> implementation of TIdICMPClient involving TTL, and perhaps that's why
> they've kept the property protected?
> Can anyone give me any more information on this? I'd really prefer to use
> Indy to be honest!
>
> PS: I'm using Indy 10.0.52 I believe.
>
> "Ryan" <nospam@nospam.nospam> wrote in message
> news:45dc73b6@newsgroups.borland.com...
>> Hiya,
>> I'm trying to write a traceroute function for Delphi, and have been
>> trying several pieces of code to get it working.
>> It seems any writing to TIdICMPClient's TTL property (which I had to
>> decend to use),
>> cause the ping to time out.
>>
>> This is despite the fact that if you look at the
>> packets using Ethereal, the pings return rapidly with 'TTL expired'!
>>
>> Yet by using OnReply in aforementioned class I just get a timeout. I
>> don't get it at all. I've even tried several different hosts to ping.
>>
>> If I don't write to TTL, the ping comes back as normal, but this is the
>> echo destination ping, which is of no use to me in building a trace
>> table.
>> So, I started using TIdTraceRoute. This comes back with hostname '' and
>> ip address = 0.0.0.0 for every hop, with FReplyStatus=rsTimeout.
>> What's going on!?
>> PS, I'm using windows 2003 server and delphi 2006.
>>
>> Code:
>> type
>> TIdIcmpClientAccess = class(TIdIcmpClient);
>> TMainForm = class(TForm)
>> ICMP: TIdIcmpClient;
>> ...
>>
>> procedure TMainForm.GoClick(Sender: TObject);
>> var Trace: TIdTraceRoute;
>> begin
>> FDestIP := GStack.ResolveHost('www.google.com'); // For example
>>
>> Trace:=TIdTraceRoute.Create(self);
>> Trace.OnReply:=ICMPReply;
>> Trace.Host:=FDestIP;
>> Trace.Trace;
>> // ----------------------
>> // Or alternatively:
>> TIdIcmpClientAccess(ICMP).TTL := 1;
>> icmp.Host:=FDestIP;
>> icmp.Ping;
>> end;
>>
>> procedure TMainForm.ICMPReply(ASender: TComponent; const AReplyStatus:
>> TReplyStatus);
>> begin
>> Reply := AReplyStatus;
>> Inc(ReplyId);
>> showmessage('"'+AReplyStatus.HostName+'" '+AReplyStatus.FromIpAddress);
>> ProcessResponse; // Goes on to check Reply.ReplyStatusType.
>> This always returns rsTimeOut, never rsTTLExceeded.
>> end;
none