public void run() {
		while (!sharedData.isEndOfProgram()) {
			Socket socket = null;
			try {
				socket = serverSock.accept();
			} catch (SocketTimeoutException e1) {

			} catch (IOException e2) {
				e2.printStackTrace();
			}

			if (socket != null) {
				sharedData.setClearClients(false);
				MiddlewareUnit newUnit = new MiddlewareUnit(sharedData);
				if (newUnit.setUp(socket)) {
					newUnit.start();
					// sharedData.addUnit(newUnit);
				}
			}

			if (sharedData.getFileBufferSize() >= sharedData.getOutputSize()) {
				sharedData.flushOutput();
			}
		}

		System.out.println("server socket end");
	}