🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #1426

Re: ping

#1426
From: billaras
Date: Wed, 16 Feb 2005 11:23
68 lines
3072 bytes
i have tried to use the code provided above in a previous question  the code
is  following:
void __fastcall TForm1::Button1Click(TObject *Sender)
{


   IdIcmpClient1->Host=Edit1->Text;
   AnsiString s;
   IdIcmpClient1->Ping();
   switch(IdIcmpClient1->ReplyStatus.ReplyStatusType)
   {
      case rsEcho:
   s = "Reply from " + IdIcmpClient1->ReplyStatus.FromIpAddress
         + (": bytes=" +
AnsiString(IdIcmpClient1->ReplyStatus.BytesReceived))
         + (" time=" +
AnsiString(IdIcmpClient1->ReplyStatus.MsRoundTripTime) + "ms")
         + (" TTL=" + AnsiString(IdIcmpClient1->ReplyStatus.TimeToLive));
         ShowMessage(s);
      break;

      case rsError:
         ShowMessage("Request Error");
      break;

      case rsTimeOut:
         ShowMessage("Request Timed Out");
      break;

      case rsErrorUnreachable:
         ShowMessage("Host Unreachable");
      break;

      case rsErrorTTLExceeded:
         ShowMessage("TTL Exceeded");
      break;
   Memo1->Lines->Add(s);
   }
}

the problem is that i receive a 0 value in time if i execute many times fast
and most important that the time i get is very big..
what i mean is..if i ping a computer in my lan a receive from dos a <1ms
time in my program a value around 16ms and withe the code above around
>36..its very strange indeed .is there any explaination?


� "billaras" <billaras1234@hotmail.com> ������ ��� ������
news:42132571@newsgroups.borland.com...
> (this question is also posted in students)
>
> i would like to ping a client  ,i tryed to use tIdIcmpClient ,the code i
> wrote is..
> void __fastcall TForm1::Button1Click(TObject *Sender)
> {
> IdIcmpClient1->Host=Edit1->Text;
>   IdIcmpClient1->Ping();
> Memo1->Lines->Add(IdIcmpClient1->ReplyStatus.MsRoundTripTime);
>
> }well when i execute the code many times fast i get a 0 value returned ,is
> this normal?
> also if i am behind a proxy server how can i declare which is the gateway
> ?beacause i can only ping the computers in my lan
> network,noone in the internet...
>
>
>
>
Technical Details
Message-ID: <42132d3b@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42132571@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,c5a3fcdc89c311f9
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII
Reply-To: "billaras" <billaras1234@hotmail.com>
From: "billaras" <billaras1234@hotmail.com>
Newsgroups: borland.public.cppbuilder.internet.web
References: <42132571@newsgroups.borland.com>
Subject: Re: ping
Date: Wed, 16 Feb 2005 13:23:41 +0200
Lines: 70
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 195.251.45.43
Message-ID: <42132d3b@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1108553019 195.251.45.43 (16 Feb 2005 03:23:39 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail