Ok,
I have been fighting with this script for a day now! I have a friend who wanted to monitor all the ftp sites he has access to. I store the IP and Port of each ftp in a database and then run through it and use fsockopen() to see which are online or offline. The script seems to work fine, but then every once and a while we will add a site to the list and the script hangs for several minutes before finishing.
Now, i have my timeout set to 3 seconds, so I really don't understand what I am doing wrong. Im not a newbie, but i am not an expert either.
What I have discoverd in debugging is that if a server exists and i tell it the wrong port, it WILL hang. When i change the port back to the correct one, the page loads instantly. So, it IS timing out somewhere, but i am unsure as to where. Please please please help me. this is the line that is doing the connecting...
$fp = @fsockopen(server($addr), $port, $errno, $errstr, 3);
*server($addr) is a function that formats an address to make sure it is correct
Im going to lose if it I cant figure it out. Also, please explain to me in not too technical terms as I lack expert intelligence of PHP hehe.. see ya!
- Mike