 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Tyler McCloud Guest
|
Posted: Mon Jan 17, 2005 8:32 pm Post subject: How to ping many hosts? |
|
|
I'm sorry I posted in the wrong thread. I'm posting in the right place now.
Sorry about the double post.
Can anyone help me as to how I could use TidICMPclient component to ping
many hosts and get their responses without having to use more then 1
component. I want to write a program to keep track of computers/hardware
that are pingable.
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Jan 17, 2005 9:50 pm Post subject: Re: How to ping many hosts? |
|
|
"Tyler McCloud" <tyler (AT) designlogic (DOT) net> wrote
| Quote: | Can anyone help me as to how I could use TidICMPclient component to
ping many hosts and get their responses without having to use more then 1
component. I want to write a program to keep track of computers/hardware
that are pingable.
|
Have a look at the "multithreaded stThreadBlocking Tserversocket /
Tclientsocket" discussion in this same newsgroup. You can use the same
concept with TIdICMPClient.
Gambit
|
|
| Back to top |
|
 |
Martin James Guest
|
Posted: Tue Jan 18, 2005 5:23 am Post subject: Re: How to ping many hosts? |
|
|
| Quote: |
Can anyone help me as to how I could use TidICMPclient component to ping
many hosts and get their responses without having to use more then 1
component. I want to write a program to keep track of computers/hardware
that are pingable.
|
Why the 'one component' restriction? This forces you to serialise the
pings. It's usual to perform the pings in parallel, for which you need more
than one component.
If you insist on one component, the pings may take some considerable time.
Rgds,
Martin
|
|
| Back to top |
|
 |
Tyler McCloud Guest
|
Posted: Tue Jan 18, 2005 10:31 pm Post subject: Re: How to ping many hosts? |
|
|
Well I would like to do something like so
for count:=0 to list.of.ips do begin
if ping(hosthere) then begin
//pinable within 500ms
end else begin
//over 500ms or no response.
end;
end;
"Martin James" <mjames_falcon (AT) dial (DOT) pipex.com> wrote
| Quote: |
Can anyone help me as to how I could use TidICMPclient component to ping
many hosts and get their responses without having to use more then 1
component. I want to write a program to keep track of
computers/hardware
that are pingable.
Why the 'one component' restriction? This forces you to serialise the
pings. It's usual to perform the pings in parallel, for which you need
more
than one component.
If you insist on one component, the pings may take some considerable time.
Rgds,
Martin
|
|
|
| Back to top |
|
 |
Martin James Guest
|
Posted: Wed Jan 19, 2005 12:57 am Post subject: Re: How to ping many hosts? |
|
|
| Quote: | for count:=0 to list.of.ips do begin
if ping(hosthere) then begin
//pinable within 500ms
end else begin
//over 500ms or no response.
end;
end;
|
Well, yes, something of that sort would surely work, though 500ms is short
for many routes. I assumed you wanted something better than a loop that, if
executed in the main thread, would sieze up the app for
(500*listOfIps.count) ms. If you are going to thread the ping to avoid the
frezing, it would make more sense, in general, to use more than one
component so as to allow the pings to run concurrently, either by using one
thread per server, (short list), or a fixed-size pool of threads, (long
list).
Rgds,
Martin
|
|
| Back to top |
|
 |
Tyler McCloud Guest
|
Posted: Mon Jan 24, 2005 9:21 pm Post subject: Re: How to ping many hosts? |
|
|
Yes I see what you're saying. My skill for writing code isn't that good so
I wanted to keep it easy and simple. I guess I'll just have learn some
more. I appreciate the ideas and help.
"Martin James" <mjames_falcon (AT) dial (DOT) pipex.com> wrote
| Quote: | for count:=0 to list.of.ips do begin
if ping(hosthere) then begin
//pinable within 500ms
end else begin
//over 500ms or no response.
end;
end;
Well, yes, something of that sort would surely work, though 500ms is short
for many routes. I assumed you wanted something better than a loop that,
if
executed in the main thread, would sieze up the app for
(500*listOfIps.count) ms. If you are going to thread the ping to avoid
the
frezing, it would make more sense, in general, to use more than one
component so as to allow the pings to run concurrently, either by using
one
thread per server, (short list), or a fixed-size pool of threads, (long
list).
Rgds,
Martin
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|