Can anyone suggest why this script (well, part of the script) fails on the "while(($bug=socket_read..." line after it successfully loops several times? (Of course, it is only after it timesout, but that is what I need it to do.)
---CODE---------------------------------- $msg_recv = 3; $timeout = array('sec' => 5, 'usec' => 0);
// ENTER LOOP
do {
$data = "";
socket_set_block($socket);
socket_set_option($socket,SOL_SOCKET,SO_RCVTIMEO,$timeout);
>>> while(($buf = socket_read($socket,128,PHP_BINARY_READ)) !== false) { <<<
$data .= $buf;
---OUTPUT----------------------------------
PHP Warning: socket_read() unable to read from socket [35]: Resource temporarily unavailable in /Users/rene/Sites/gpspolice/titan/cr.php on line 65
Because the read operation times out, so you get this warning. If you don't want this warning to show up use $buf = @socket_read($socket,128,PHP_BINARY_READ) and check with socket_last_error() what is going on.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php