protected function socket_send($socket, $message)
	{
		$serialized_message = @serialize($message);
		if ($serialized_message == false)
		{
			$this->log('socket_send failed to serialize message', self::LOG_LEVEL_CRIT);
			return false;
		}

		$header = pack('N', strlen($serialized_message));
		$data = $header . $serialized_message;
		$bytes_left = strlen($data);
		while ($bytes_left > 0)
		{
			$bytes_sent = @socket_write($socket, $data);
			if ($bytes_sent === false)
			{
				$this->log('socket_send error: ' . socket_strerror(socket_last_error()), self::LOG_LEVEL_CRIT);
				return false;
			}

			$bytes_left -= $bytes_sent;
			$data = substr($data, $bytes_sent);
		}

		return true;
	}
protected function socket_send($socket, $message)
	{
		$serialized_message = @serialize($message);
		if ($serialized_message == false)
		{
			$this->log('socket_send failed to serialize message', self::LOG_LEVEL_CRIT);
			return false;
		}

		$header = pack('N', strlen($serialized_message));
		$data = $header . $serialized_message;
		$bytes_left = strlen($data);
		while ($bytes_left > 0)
		{
			$bytes_sent = @socket_write($socket, $data);
			if ($bytes_sent === false)
			{
				$this->log('socket_send error: ' . socket_strerror(socket_last_error()), self::LOG_LEVEL_CRIT);
				return false;
			}

			$bytes_left -= $bytes_sent;
			$data = substr($data, $bytes_sent);
		}

		return true;
	}
protected function socket_send ( $ socket , $ message ) { $ serialized_message = @ serialize ( $ message ) ; if ( $ serialized_message == false ) { $ this -> log ( 'socket_send failed to serialize message' , self :: LOG_LEVEL_CRIT ) ; return false ; } $ header = pack ( 'N' , strlen ( $ serialized_message ) ) ; $ data = $ header . $ serialized_message ; $ bytes_left = strlen ( $ data ) ; while ( $ bytes_left > 0 ) { $ bytes_sent = @ socket_write ( $ socket , $ data ) ; if ( $ bytes_sent === false ) { $ this -> log ( 'socket_send error: ' . socket_strerror ( socket_last_error ( ) ) , self :: LOG_LEVEL_CRIT ) ; return false ; } $ bytes_left -= $ bytes_sent ; $ data = substr ( $ data , $ bytes_sent ) ; } return true ; }
Sends a serializable message to the socket.

@param resource $socket  The socket to send the message on.
@param mixed    $message The serializable message to send.
@return type Returns true on success, false on failure
Sends a serializable message to the socket .