private void handleConnection(Socket socket) throws IOException, Exception {
		while (true) {
			Object o = fromClient.readObject();
			if (o instanceof EventPackage) {
				EventPackage eventPackage = (EventPackage) o;
				updateServer(eventPackage);
				updateClient(eventPackage);
			} else if (o instanceof FilePackage) {
				FilePackage fp = (FilePackage) o;

				server.fileSystem.addFile(fp);
				updateClient(fp);
				System.out.println("received file from client");

			} else if (o instanceof FilenameChangePackage) {
				FilenameChangePackage f = (FilenameChangePackage) o;
				server.fileSystem.changeFileName(f.docNum, f.newFileName);
				System.out.println("received change name request from client");
				updateClient(f);

			} else if (o instanceof String) {

				String str = (String) o;
				if (o.equals("new file")) {
					String s = (String) o;
					server.fileSystem.addEmptyFile();
					updateClientwithEmptyFile(s);
					System.out.println("New Document");
				} else if (str.substring(0, 6).equals("delete")) {
					System.out
							.println("serverThread: client delete file on server");
					int docNum = Integer.parseInt(str.substring(6));
					server.fileSystem.deleteDoc(docNum);
					updateClientwithFileDeletion(str);
				}
			}

		}
	}