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?