protected function socket_receive($socket)
	{
		// initially read to the length of the header size, then
		// expand to read more
		$bytes_total = self::SOCKET_HEADER_SIZE;
		$bytes_read = 0;
		$have_header = false;
		$socket_message = '';
		while ($bytes_read < $bytes_total)
		{
			$read = @socket_read($socket, $bytes_total - $bytes_read);
			if ($read === false)
			{
				$this->log('socket_receive error: ' . socket_strerror(socket_last_error()), self::LOG_LEVEL_CRIT);
				return false;
			}

			// blank socket_read means done
			if ($read == '')
			{
				break;
			}

			$bytes_read += strlen($read);
			$socket_message .= $read;

			if (!$have_header && $bytes_read >= self::SOCKET_HEADER_SIZE)
			{
				$have_header = true;
				list($bytes_total) = array_values(unpack('N', $socket_message));
				$bytes_read = 0;
				$socket_message = '';
			}
		}

		$message = @unserialize($socket_message);

		return $message;
	}
protected function socket_receive($socket)
	{
		// initially read to the length of the header size, then
		// expand to read more
		$bytes_total = self::SOCKET_HEADER_SIZE;
		$bytes_read = 0;
		$have_header = false;
		$socket_message = '';
		while ($bytes_read < $bytes_total)
		{
			$read = @socket_read($socket, $bytes_total - $bytes_read);
			if ($read === false)
			{
				$this->log('socket_receive error: ' . socket_strerror(socket_last_error()), self::LOG_LEVEL_CRIT);
				return false;
			}

			// blank socket_read means done
			if ($read == '')
			{
				break;
			}

			$bytes_read += strlen($read);
			$socket_message .= $read;

			if (!$have_header && $bytes_read >= self::SOCKET_HEADER_SIZE)
			{
				$have_header = true;
				list($bytes_total) = array_values(unpack('N', $socket_message));
				$bytes_read = 0;
				$socket_message = '';
			}
		}

		$message = @unserialize($socket_message);

		return $message;
	}
protected function socket_receive ( $ socket ) { // initially read to the length of the header size, then // expand to read more $ bytes_total = self :: SOCKET_HEADER_SIZE ; $ bytes_read = 0 ; $ have_header = false ; $ socket_message = '' ; while ( $ bytes_read < $ bytes_total ) { $ read = @ socket_read ( $ socket , $ bytes_total - $ bytes_read ) ; if ( $ read === false ) { $ this -> log ( 'socket_receive error: ' . socket_strerror ( socket_last_error ( ) ) , self :: LOG_LEVEL_CRIT ) ; return false ; } // blank socket_read means done if ( $ read == '' ) { break ; } $ bytes_read += strlen ( $ read ) ; $ socket_message .= $ read ; if ( ! $ have_header && $ bytes_read >= self :: SOCKET_HEADER_SIZE ) { $ have_header = true ; list ( $ bytes_total ) = array_values ( unpack ( 'N' , $ socket_message ) ) ; $ bytes_read = 0 ; $ socket_message = '' ; } } $ message = @ unserialize ( $ socket_message ) ; return $ message ; }
Receives a serialized message from the socket.

@param resource $socket The socket to receive the message from.
@return mixed Returns data on success, false on failure
Receives a serialized message from the socket .