fsockopen() does seem to be the better choice, and it reports standard errno style messages.
From the manual:
If the call fails, it will return FALSE and if the optional errno and errstr arguments are present they will be set to indicate the actual system level error that occurred in the system-level connect() call. If the value returned in errno is 0 and the function returned FALSE, it is an indication that the error occurred before the connect() call. This is most likely due to a problem initializing the socket. Note that the errno and errstr arguments will always be passed by reference.
So, try this:
// int fsockopen ( string target, int port [, int errno [, string errstr [, float timeout]]])
$camport=6969;
$errno = 0;
$errstr = "No error";
$timeout = 30; //seconds?
$fp = fsockopen( "camhost", $camport, $errno, $errstr, $timeout);
if($fp == 0) {
echo "Failed to connect: $errno: $errstr<br>\n";
}
post the results back to this forum, I'd like to see what the output is.
Make sure that it is the fsockopen() that is failing, and not a subsequent read from the file pointer that is failing.