我如何使用delphi跟踪IP

发布于 2024-10-02 08:13:28 字数 689 浏览 1 评论 0原文

我需要跟踪 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

潇烟暮雨 2024-10-09 08:13:28

我刚刚在我的博客上写了一篇文章,可以帮助你。

建筑物使用delphi实现IP地理定位的traceroute应用程序

I just wrote a entry on my blog, wich can help you.

Building a traceroute application with IP geolocation using delphi

和我恋爱吧 2024-10-09 08:13:28

跟踪基本上基于发送 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文