I have a program in CGIDEV2 that uses the CHKSVR command that Scott Klement put together a few years ago. There is really nothing special about the command, it check checks to see if a server is listening on a certain IP and port. I actually had written an RPG ILE program originally that did something very similar and it failed the same way that the CHKSVR program is now failing but ONLY when called from the CGIDEV2 program running on Apache.

I have spent endless hours trying to sort through why this command, which uses a socket connection, works fine from the command line but fails when called from the CGIDEV2 program running in the Apache server. The failure is that the "timeout" parameter is seemingly ignored when called from within the CGIDEV2 program running on Apache. If I invoke the CGIDEV2 program from the command line and step through the call to CHKSVR, I get the results I expect: If the host isn't online, it returns with the failure error within 2 seconds. If I invoke the CGIDEV2 program that calls CHKSVR in my web browser, it will take 6-8 minutes to iterate through the 12 hosts that the program checks. That would indicate that the timeout that I pass to the program is being ignored within the call when running in Apache.

If I look at the job log, I see 4 hosts that refused the connection request ("A remote host refused an attempted connect operation."). Those four hosts fail within milliseconds. The 5th host doesn't error out for almost 3 minutes and returns ("A remote host did not respond within the timeout period") and the 6th host responds with the same message 3 minutes after that. I set the timeout on the CHKSVR call to 2 seconds so where the 3 minutes (180 seconds) is coming from is a mystery. FWIW in php.ini the max_execution_time = 30 and the max_input_time = 60. I don't see anything that would delay a response for 3 minutes.

None of this makes sense to me unless there is some kind of setting in PHP and Apache that causes the timeout to be ignored. But how that would affect the CHKSVR program is anyone's guess.

Ideas? I am at the end of my rope.....


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.