Discussion:
Delphi Indy 10 TIdIcmpClient
(too old to reply)
v***@dk.is
2006-12-23 13:52:06 UTC
Permalink
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


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;
Don Siders
2006-12-23 20:03:55 UTC
Permalink
Post by v***@dk.is
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...

---
Post by v***@dk.is
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;
v***@dk.is
2006-12-24 17:24:15 UTC
Permalink
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;
Post by Don Siders
Post by v***@dk.is
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
* 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...
---
Post by v***@dk.is
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;
Don Siders
2006-12-27 17:54:35 UTC
Permalink
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 ?
For WinNT and Win2000... definitely.

For WinXP, ICMP is tied to ICF(Internet Connetion Firewall). ICMP requests
/ responses are not enabled (by default) in Win XP and ICF. Changing ICF
settings requires Local Administrator privileges.

hth...
v***@dk.is
2006-12-29 01:56:59 UTC
Permalink
I´m not getting the information i needed from the TidTraceRoute

this is what i get when i use the command promt trace route command

C:\Documents and Settings\valdi>tracert mbl.is
Tracing route to mbl.is [193.4.96.21]
over a maximum of 30 hops:

1 <1 ms <1 ms <1 ms dmz.basis.is [85.197.248.1]
2 <1 ms <1 ms <1 ms ipf-gw.basis.is [85.197.248.130]
3 1 ms 1 ms 1 ms basis-gw.ipf.is [85.197.255.137]
4 1 ms 1 ms 1 ms vl3-rtr1.tg.ipf.is [85.197.193.65]
5 1 ms 1 ms 1 ms rix-gw.islandssimi.is [193.4.59.13]
6 2 ms 2 ms 2 ms A024-V2009.metronet.is [193.4.253.131]
7 2 ms 3 ms 3 ms 193.4.252.166
8 2 ms 2 ms 3 ms neumann.mbl.is [193.4.96.21]

Trace complete.

This is what i get with the indy trace route

0.0.0.0 []
0.0.0.0 []
0.0.0.0 []
0.0.0.0 []
0.0.0.0 []
0.0.0.0 []
0.0.0.0 []
193.4.96.21 [neumann.mbl.is]

I need to get the first and second replay to identify the isp so i can
resolve the isp mail server witch in this case the isp is basis.is
then i try to gethostbyname mail.basis.is --> smtp.basis.is
if these are valid then i use them to send mail messages

does any one have an idea why i get different trace in Indy TidTraceRoute?
Does any one know of a better method of doing this?
Post by Don Siders
Post by v***@dk.is
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 ?
For WinNT and Win2000... definitely.
For WinXP, ICMP is tied to ICF(Internet Connetion Firewall). ICMP
requests / responses are not enabled (by default) in Win XP and ICF.
Changing ICF settings requires Local Administrator privileges.
hth...
v***@dk.is
2007-01-04 15:56:23 UTC
Permalink
Does any one know of a solution for this problem?
I this a know bug?
Post by v***@dk.is
I´m not getting the information i needed from the TidTraceRoute
this is what i get when i use the command promt trace route command
C:\Documents and Settings\valdi>tracert mbl.is
Tracing route to mbl.is [193.4.96.21]
1 <1 ms <1 ms <1 ms dmz.basis.is [85.197.248.1]
2 <1 ms <1 ms <1 ms ipf-gw.basis.is [85.197.248.130]
3 1 ms 1 ms 1 ms basis-gw.ipf.is [85.197.255.137]
4 1 ms 1 ms 1 ms vl3-rtr1.tg.ipf.is [85.197.193.65]
5 1 ms 1 ms 1 ms rix-gw.islandssimi.is [193.4.59.13]
6 2 ms 2 ms 2 ms A024-V2009.metronet.is [193.4.253.131]
7 2 ms 3 ms 3 ms 193.4.252.166
8 2 ms 2 ms 3 ms neumann.mbl.is [193.4.96.21]
Trace complete.
This is what i get with the indy trace route
0.0.0.0 []
0.0.0.0 []
0.0.0.0 []
0.0.0.0 []
0.0.0.0 []
0.0.0.0 []
0.0.0.0 []
193.4.96.21 [neumann.mbl.is]
I need to get the first and second replay to identify the isp so i can
resolve the isp mail server witch in this case the isp is basis.is
then i try to gethostbyname mail.basis.is --> smtp.basis.is
if these are valid then i use them to send mail messages
does any one have an idea why i get different trace in Indy TidTraceRoute?
Does any one know of a better method of doing this?
Post by Don Siders
Post by v***@dk.is
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 ?
For WinNT and Win2000... definitely.
For WinXP, ICMP is tied to ICF(Internet Connetion Firewall). ICMP
requests / responses are not enabled (by default) in Win XP and ICF.
Changing ICF settings requires Local Administrator privileges.
hth...
Ryan
2007-02-21 16:06:01 UTC
Permalink
I too am having the same problem using Indy 10.1.5.
Any calls 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.
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.
Post by v***@dk.is
Does any one know of a solution for this problem?
I this a know bug?
IŽm not getting the information i needed from the TidTraceRoute
this is what i get when i use the command promt trace route command
C:\Documents and Settings\valdi>tracert mbl.is
Tracing route to mbl.is [193.4.96.21]
1 <1 ms <1 ms <1 ms dmz.basis.is [85.197.248.1]
2 <1 ms <1 ms <1 ms ipf-gw.basis.is [85.197.248.130]
3 1 ms 1 ms 1 ms basis-gw.ipf.is [85.197.255.137]
4 1 ms 1 ms 1 ms vl3-rtr1.tg.ipf.is [85.197.193.65]
5 1 ms 1 ms 1 ms rix-gw.islandssimi.is [193.4.59.13]
6 2 ms 2 ms 2 ms A024-V2009.metronet.is [193.4.253.131]
7 2 ms 3 ms 3 ms 193.4.252.166
8 2 ms 2 ms 3 ms neumann.mbl.is [193.4.96.21]
Trace complete.
This is what i get with the indy trace route
0.0.0.0 []
0.0.0.0 []
0.0.0.0 []
0.0.0.0 []
0.0.0.0 []
0.0.0.0 []
0.0.0.0 []
193.4.96.21 [neumann.mbl.is]
I need to get the first and second replay to identify the isp so i can
resolve the isp mail server witch in this case the isp is basis.is
then i try to gethostbyname mail.basis.is --> smtp.basis.is
if these are valid then i use them to send mail messages
does any one have an idea why i get different trace in Indy
TidTraceRoute?
Does any one know of a better method of doing this?
Post by Don Siders
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 ?
For WinNT and Win2000... definitely.
For WinXP, ICMP is tied to ICF(Internet Connetion Firewall). ICMP
requests / responses are not enabled (by default) in Win XP and ICF.
Changing ICF settings requires Local Administrator privileges.
hth...
Loading...