public static void stop() {
	
		if (CamServer.indicator != null) {
			CamServer.indicator.setState(StatusIndicator.PROGRESS);
		}

		active = false;
		// if the streaming thread is alive interrupt it and close it
		if (streamThread != null && streamThread.isAlive()) {
			streamThread.interrupt();
			try {
				streamThread.join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}

		// same with the server thread, but this time, to interrupt it
		// close the server socket first, which produces a socketException in
		// serverThread when
		// trying to execute serverSocket.accept()
		try {
			serverSocket.close();
		} catch (Exception e) {
			// error closing the server socket
		}

		if (serverThread != null && serverThread.isAlive()) {
			serverThread.interrupt();
			try {
				serverThread.join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}

		videoDevice.releaseControlList();

		CamServer.logger.info(MyLogger.getLogRecord("VIDEO_STREAMING_FINISH"));
		if (CamServer.indicator != null) {
			CamServer.indicator.setState(StatusIndicator.DOWN);
		}
	}