我如何使用delphi跟踪IP
我需要跟踪 IP 的路由,实际上我正在使用 idTraceRoute
单元中的 TIdTraceRoute
indy 组件。
IdTraceRoute1:= TIdTraceRoute.Create(Self);
IdTraceRoute1.ResolveHostNames:= True;
IdTraceRoute1.ReceiveTimeout:= 5000;
IdTraceRoute1.OnReply:= TraceRoute;
IdTraceRoute1.Host:= 'www.google.com';
IdTraceRoute1.Trace;
procedure TForm1.TraceRoute(ASender: TComponent;
const AReplyStatus: TReplyStatus);
begin
Memo1.Lines.Add(AReplyStatus.FromIpAddress);
end;
但总会回来。
0.0.0.0
0.0.0.0
0.0.0.0
0.0.0.0
0.0.0.0
0.0.0.0
是否存在另一种跟踪 ip 的方法,可能使用 windows api 或使用另一个 indy 组件?
实际上我正在使用delphi-xe和Windows 7。
i need trace the route of an ip, actually i am using the TIdTraceRoute
indy component from the idTraceRoute
unit.
IdTraceRoute1:= TIdTraceRoute.Create(Self);
IdTraceRoute1.ResolveHostNames:= True;
IdTraceRoute1.ReceiveTimeout:= 5000;
IdTraceRoute1.OnReply:= TraceRoute;
IdTraceRoute1.Host:= 'www.google.com';
IdTraceRoute1.Trace;
procedure TForm1.TraceRoute(ASender: TComponent;
const AReplyStatus: TReplyStatus);
begin
Memo1.Lines.Add(AReplyStatus.FromIpAddress);
end;
but always return.
0.0.0.0
0.0.0.0
0.0.0.0
0.0.0.0
0.0.0.0
0.0.0.0
exist another way of trace an ip maybe using windows api or using another indy component?
actually i am using delphi-xe and Windows 7.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚在我的博客上写了一篇文章,可以帮助你。
建筑物使用delphi实现IP地理定位的traceroute应用程序
I just wrote a entry on my blog, wich can help you.
Building a traceroute application with IP geolocation using delphi
跟踪基本上基于发送 ICMP 数据包,从 TTL 为 1 开始,然后不断增加直到到达目的地。因为每个路由器都会减少 TTL,并且当它达到 0 时,会向调用者返回一个错误,因此它可用于跟踪数据包所采用的“路由”。请注意,要正常工作,ICMP 协议不得被防火墙阻止。 ICMP 是一种运行在 IP 之上的协议,就像 TCP 一样。它不使用 TCP。您可以仅使用 ICMP 编写跟踪路由实用程序。但是 Windows Tracert 实用程序可以在您的系统上运行吗?
Trace is basically based on sending ICMP packets starting with a TTL of 1 and increasing it until reaching the destination. Because each router decrease the TTL, and when it reaches 0 an error is returned to the caller, it can be used to track the "route" packets takes. Note that to work the ICMP protocol must not be stopped by a firewall. ICMP is a protocol that runs atop IP, like TCP does. It doesn't use TCP. You could code a traceroute utility just using ICMP. But does the Windows tracert utility work on your system?