🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
4 messages
4 total messages Started by Armz Sun, 12 Nov 2006 05:11
Using Indy Idicmpclient to PING?
#1775
Author: Armz
Date: Sun, 12 Nov 2006 05:11
18 lines
1388 bytes
Hi, im pretty new to C/C++, im coming from Object Pascal.

I want to do an equivalent from a code in Delphi to C using the 
idicmpclient coming with Indy. I use C++ Builder 6.

Here is my Delphi code:

---
idicmpclient1.Host := 'www.l.google.com';
idicmpclient1.Ping();
label1.caption(IntToStr(idicmpclient1.ReplyStatus.MsRoundTripTime) + 'ms');
---

I think my problem in C is when im trying to convert INT to STR.

All help is appreciate to help me with this little code.

Thanks!...
Re: Using Indy Idicmpclient to PING?
#1676
Author: Michel Leunen
Date: Sun, 12 Nov 2006 11:03
25 lines
1606 bytes
Armz wrote:

> idicmpclient1.Host := 'www.l.google.com';
> idicmpclient1.Ping();
> label1.caption(IntToStr(idicmpclient1.ReplyStatus.MsRoundTripTime) + 'ms');

This should work (not tested):

#include <IdIcmpClient.hpp>

TIdIcmpClient *IdIcmpClient = new TIdIcmpClient(this);
IdIcmpClient->Host = "www.1.google.com";
IdIcmpClient->Ping();
Label1->Caption = IntToStr(IdIcmpClient->ReplyStatus.MsRoundTripTime)+ " 
ms";
delete IdIcmpClient;

Michel
-- 
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
----------------------------------------
Re: Using Indy Idicmpclient to PING?
#1682
Author: Remy Lebeau (TeamB)
Date: Mon, 13 Nov 2006 22:10
17 lines
1313 bytes
"Armz" <brain_walkers@hotmail.com> wrote in message
news:4556ad14$1@newsgroups.borland.com...

> Here is my Delphi code:
<snip>

That exact code works just fine in C++, as both Indy and the VCL are the
same in both Delphi and C++, ie:

    IdICMPClient1->Host = "www.l.google.com";
    IdICMPClient1->Ping();
    Label1->Caption(IntToStr(IdICMPClient1->ReplyStatus->MsRoundTripTime) +
"ms");


Gambit
Re: Using Indy Idicmpclient to PING?
#1677
Author: Remy Lebeau (TeamB)
Date: Mon, 13 Nov 2006 22:11
18 lines
1371 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:4558ee09$1@newsgroups.borland.com...

>     Label1->Caption(IntToStr(IdICMPClient1->ReplyStatus->MsRoundTripTime)
+
> "ms");

Whoops, should be:

    Label1->Caption = IntToStr(IdICMPClient1->ReplyStatus->MsRoundTripTime)
+ "ms";

In Delphi, you have to use the ':=' operator when assigning the Caption, so
your original snippet was wrong anyway.


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads