Re: [twsocket] Fast Pings ! Delphi->BCB

2006-02-13 Thread Angus Robertson - Magenta Systems Ltd
This is my demo trace route application you are trying to convert.  

> I cannot understand completely these parts:
> for I := 0 to Pred (T) do->(Pred(T)?)
> find PingThreadList, (Succ??)

Pred (T) means T-1 but may be more efficient for the compiler, 
Succ (T) means T+1, ditto.  

> PingThread = new TPingThread(true);??? I must delete it later?

No, it deletes itself. 

> StrPas (HostEnt^.h_name) ; -> HostEnt^.h_name?
> SetLength (PingThreadList, Succ (Length (PingThreadList))) ; 

This stuff is in the component itself, you don't need to change that 
unless you've decided the convert the whole ping component to C++.

Angus
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Fast Pings ! Delphi->BCB

2006-02-13 Thread Fastream Technologies
Here is my code:

if(pingerCount)
pingers = new ::TPingThread*[pingerCount];

for(int i = 0; i < pingerCount; ++i)
{
pingers[i] = new ::TPingThread(True);   // create suspended

PingAddThread(pingers[i]->ThreadID);  // keep threadid 
so it's freed
pingers[i]->FreeOnTerminate = true;
//pingers[i]->PingId = pingers[i]->succ(I);// 
keep track of the results
pingers[i]->OnTerminate = PingThreadTermPing;// where we 
get the response
pingers[i]->PingHostName = targetServers->Strings[i];  // 
host name or IP address to ping
pingers[i]->PingTimeout = 4000;   // ms
pingers[i]->PingTTL = 32; // hops
pingers[i]->PingLookupReply = false;  // don't need 
response host name lookup
pingers[i]->Resume();// start it now
}

...

void __fastcall httpServerThread::PingThreadTermPing(TObject *Sender)
{
if(Terminated)
return;

unsigned int pingTimeInt;
if(((TPingThread*)Sender)->ReplyTotal != 0)
{
pingTimeInt = ((TPingThread*)Sender)->ReplyRTT;
}
else
{
pingTimeInt = 4096;
}
}

I noticed this unit ten days ago and it took my 2 hours to translate.

HTH,

SZ

- Original Message - 
From: "Enrique" <[EMAIL PROTECTED]>
To: 
Sent: Monday, February 13, 2006 2:31 PM
Subject: [twsocket] Fast Pings ! Delphi->BCB


> Thanks Francois, but I'm still having problems with Delphi :-(
> How should I translate this?
> //
> for I := 0 to Pred (T) do
>begin
>if HostNames.Lines [I] <> '' then
>begin
>with TPingThread.Create (True) do   // create suspended
>begin
>PingAddThread (ThreadId) ;  // keep threadid so it's
> freed
>FreeOnTerminate := True;
>PingId := succ (I) ;// keep track of the 
> results
>OnTerminate := PingThreadTermPing ;// where we get the
> response
>PingHostName := HostNames.Lines [I] ;  // host name or IP
> address to ping
>PingTimeout := 4000 ;   // ms
>PingTTL := 32 ; // hops
>PingLookupReply := false ;  // don't need response host
> name lookup
>Resume ;// start it now
>end ;
>end;
>end ;
> //
> I cannot understand completely these parts:
> for I := 0 to Pred (T) do->(Pred(T)?)
> with TPingThread.Create (True) do   // create suspended-> TPingThread*
> PingThread = new TPingThread(true);??? I must delete it later?
>
> And...
> StrPas (HostEnt^.h_name) ; -> HostEnt^.h_name?
>
> SetLength (PingThreadList, Succ (Length (PingThreadList))) ;  -> I can't
> find PingThreadList, (Succ??)
>
>
> Thanks again !!!
> enri.
>
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Fast Pings ! -> C++ :-(

2006-02-12 Thread Francois PIETTE

> anyway, the problem is not so much to "read" the code in Delphi, but to 
> see the form and its components (with ther properties).

You can open Delphi forms with BCB !
You can even copy/paste from Delphi form to BCB forms !!

--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
http://www.overbyte.be


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Fast Pings ! -> C++ :-(

2006-02-12 Thread Enrique
procedure = void?
function?
nil = NULL
"TraceAddr: array [1..TraceMax] of string ;" = string TraceAddr[TraceMax] with 
first index = 1 ?
{$R *.DFM}  ???
"with Sender as TPingThread do" ? we are assuming that all "comes from" 
TPingThread ?
<> = !=

anyway, the problem is not so much to "read" the code in Delphi, but to see the 
form and its components (with ther properties).

enri.
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Fast Pings ! -> C++ :-(

2006-02-12 Thread Dan
- Original Message - 
From: "Francois PIETTE" <[EMAIL PROTECTED]>
To: "ICS support mailing" 
Sent: Sunday, February 12, 2006 7:23 AM
Subject: Re: [twsocket] Fast Pings ! -> C++ :-(


>> I've seen in the usermade. But the code is in Delphi,
>
> There is not much differences between Delphi and CPP code !
> Do all those replaces:
>
> ===
> :==
> .->
>

begin{
end;  }

Seriously, if you cant understand pascal but you can understand C++ 
something is wrong.

:) 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Fast Pings ! -> C++ :-(

2006-02-12 Thread Fastream Technologies
One notable addition: unlike pascal C++ is case sensitive. So you need to 
match variable and function identifiers exactly which is not the case with 
pascal code usually. For example:

procedure SetVariable(variable: boolean);

can be called in pascal as setvariable(variable); and this is legal but not 
in C++.

Regards,

SZ

- Original Message - 
From: "Francois PIETTE" <[EMAIL PROTECTED]>
To: "ICS support mailing" 
Sent: Sunday, February 12, 2006 9:23 AM
Subject: Re: [twsocket] Fast Pings ! -> C++ :-(


>> I've seen in the usermade. But the code is in Delphi,
>
> There is not much differences between Delphi and CPP code !
> Do all those replaces:
>
> ===
> :==
> .->
> begin{
> end}
> and&&
> or||
> then  
> integerint
> stringansistring
> booleanbool
>
> After those changes you mostly have CPP code.
> A procedure is a function returning nothing.
>
> --
> Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
> --
> [EMAIL PROTECTED]
> http://www.overbyte.be
>
>
>
> - Original Message - 
> From: "Enrique" <[EMAIL PROTECTED]>
> To: 
> Sent: Saturday, February 11, 2006 9:02 PM
> Subject: Re: [twsocket] Fast Pings ! -> C++ :-(
>
>
>> I've seen in the usermade. But the code is in Delphi, I don't know much
>> about Delphi, and I don't know much about multithreading too :-(
>> Anyway, are components or only samples the files on the usermade page?
>> I think that what I need to do is very simple. Perhaps somebody can help
>> with a C++ code sample or some tip, because i'm "blind" :-(
>> It's similar to an IP Scanner. I need to check if some remote IP has been
>> taken or not from my own ISP (I have dynamic IP and I want to connect 
>> with
>> a
>> specific IP, but, before, I must check if that IP is available). So,
>> sometimes I must check very much IPs (perhaps 255 if I need to connect
>> with
>> something like 1.2.3.x), and I need to do this as quickly as possible.
>>
>> Thanks !
>> enri.
>>
>> -- 
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://www.elists.org/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
>
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Fast Pings ! -> C++ :-(

2006-02-11 Thread Francois PIETTE
> I've seen in the usermade. But the code is in Delphi,

There is not much differences between Delphi and CPP code !
Do all those replaces:

===
:==
.->
begin{
end}
and&&
or||
then  
integerint
stringansistring
booleanbool

After those changes you mostly have CPP code.
A procedure is a function returning nothing.

--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
http://www.overbyte.be



- Original Message - 
From: "Enrique" <[EMAIL PROTECTED]>
To: 
Sent: Saturday, February 11, 2006 9:02 PM
Subject: Re: [twsocket] Fast Pings ! -> C++ :-(


> I've seen in the usermade. But the code is in Delphi, I don't know much
> about Delphi, and I don't know much about multithreading too :-(
> Anyway, are components or only samples the files on the usermade page?
> I think that what I need to do is very simple. Perhaps somebody can help
> with a C++ code sample or some tip, because i'm "blind" :-(
> It's similar to an IP Scanner. I need to check if some remote IP has been
> taken or not from my own ISP (I have dynamic IP and I want to connect with 
> a
> specific IP, but, before, I must check if that IP is available). So,
> sometimes I must check very much IPs (perhaps 255 if I need to connect 
> with
> something like 1.2.3.x), and I need to do this as quickly as possible.
>
> Thanks !
> enri.
>
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Fast Pings ! -> C++ :-(

2006-02-11 Thread Enrique
I've seen in the usermade. But the code is in Delphi, I don't know much 
about Delphi, and I don't know much about multithreading too :-(
Anyway, are components or only samples the files on the usermade page?
I think that what I need to do is very simple. Perhaps somebody can help 
with a C++ code sample or some tip, because i'm "blind" :-(
It's similar to an IP Scanner. I need to check if some remote IP has been 
taken or not from my own ISP (I have dynamic IP and I want to connect with a 
specific IP, but, before, I must check if that IP is available). So, 
sometimes I must check very much IPs (perhaps 255 if I need to connect with 
something like 1.2.3.x), and I need to do this as quickly as possible.

Thanks !
enri. 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Fast Pings !

2006-02-11 Thread Francois PIETTE
> I need to do very much pings, but it seems to be very slow, I have seen
> programs that check more than 10 IPs for second.
> How can I increase the speed? it's possible to do it asynchronous?

You need to use multithreading.
If I remember well, there is something related to ping on the usermade page 
at overbyte website.

--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
http://www.overbyte.be


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be