public void run() {
		while(true) {
			System.out.println("Running");
			if(gui.connected) {
				System.out.println("Connected");
				try {
					int o = Integer.parseInt((String)inFromServer.readObject());
					switch(o){
					case 3: { // Broadcast
						gui.update((String)inFromServer.readObject());
						break;
					}
					case 4: { // List users
						gui.update("[List of users:]");
						String name;
						while (!((name = (String)inFromServer.readObject()).equalsIgnoreCase("5"))) {
							gui.update("> " + name);
						}
						gui.update("[Done.]");
						break;
					}
					case 6: { // Whisper
						gui.update((String)inFromServer.readObject());
						break;
					}
					case 9: { // Exit
						gui.update("[Severing connection...]");
						outToServer.close();
						inFromServer.close();
						clientSocket.close();
						gui.connected = false;
						gui.update("[Connection severed.]");
						break;
					}
					default: {
						gui.update("[Received garbage from server.]");
					}
					}
					System.out.println("Listening");
				} catch (IOException e) {
					System.out.println("IOException encountered while listening to server.");
					gui.disconnect();
					gui.update("[Server disconnected unexpectedly.]");
				} catch (ClassNotFoundException e) {
					System.out.println("Object received not a String.");
				}
			}
		}
	}