In oder to catch the SOAP Server thread running in backgroun in CLOSE_WAIT state , Im writing a code to execute the netstat within my server code
I understand that popen is better than system() as o/p of system() cant be stored.
I have the following code snipette that uses popen
FILE * count ;
char buff[1024];
if (!(count =popen("netstat -an | grep -i 6071 | grep CLOSE_WAIT")))
{
PRINT(" NO SOAP HUNG THREAD FOUND ");
}
while(fgets(buff, sizeof(buff), in) != NULL )
{
PRINT("\n ... SOAP Server HUNG Thread found");
}
Can someone please let me know if above code can be improved better ?
Thanks