-
popen takes too long?
I'm writing a program to check whether servers are still alive. So I'm executing the ping command with popen, to make sure my program isn't blocked during the ping and I can execute a lot of pings in parallel. The problem however is that sometimes the popen command is blocked for a while and it takes seconds before it is executed.
Here's the popen part of my program:
Code:
strcpy(command,"ping -c 1 -w 1 ");
strcat(command,IpAddress);
M_fp = popen(command,"r");
I think it has something to do with a maximum open child processes or so, because this happens only when there are a lot of pings going on. Anybody an idea why this takes sometimes so long?
Is there a function to retrieve the number of open child processes?
-
> to make sure my program isn't blocked during the ping and I can execute a lot of pings in parallel.
So you've just managed to DoS yourself, what do you want from us?
Maybe find another way to solve your problem?
-
I'm doing something like 20 pings each second, so it's not that my server can't handle that.
I would just like to know what the reason can be that sometimes popen takes a few seconds to execute.
And I'd like to know how I can retrieve the number of open child processes