public void waitForConnection() {
		if (!server.isConnecting() && !server.isConnected()) {
			if (server.isConnectedToNetwork()) {
				new Thread(new Runnable() {
					@Override
					public void run() {
						updateStatus(WAITING);
						while (!server.waitForConnection()) {
							if (server.isAbortRequestSent())
								return;
						}
						updateStatus(RUNNING);
						server.sendCMD(CMD.INTRODUCE, getName());
						startSendingSensorsData();
						startProceedingCommands();
					}
				}).start();
			} else {
				log("no network");
				updateStatus(ERROR);
			}
		} else {
			log("already connecting");
			updateStatus(ERROR);
		}
	}