private Object dispatch(RMIMessage m) {
		Object ret = null;
		if (m == null) {
			System.out.println("Message is empty");
			return ret;
		}
		// get service name from message and get corresponding remote object
		String serviceName = m.getService();
		MyRemote rm = serverListener.servicetbl.get(serviceName);
		// get method name from message
		String methodName = (String) m.getMethod();
		// get arguments from message
		Object[] args = (Object[]) m.getContent();
		// get argument type from message
		Class<?>[] parameterTypes = (Class<?>[]) m.getParameterTypes();

		try {
			// invoke the method
			Method method = rm.getClass().getMethod(methodName, parameterTypes);
			ret = method.invoke(rm, args);
		} catch (NoSuchMethodException e) {
			System.out.println("No Such Method Exception");
			ret = new RemoteException("Remote Exception: No Such Method");
		} catch (SecurityException e) {
			System.out.println("Security Exception");
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			System.out.println("Illegal Acess Exception");
			e.printStackTrace();
		} catch (IllegalArgumentException e) {
			System.out.println("Illegal Argument Exception");
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			System.out.println("Invocation Target Exception");
			e.printStackTrace();
		}
		return ret;

	}