public void run() {
			// Get config data
			ConfigManager cm = new ConfigManager();
			// Connect to server through RMI port 1099.
			Rmi rmi = null;
			try {
				Registry registry = LocateRegistry.getRegistry(
						cm.getServerIp(), 1099);
				rmi = (Rmi) registry.lookup("pcs");
			} catch (RemoteException | NotBoundException e) {
				JOptionPane.showMessageDialog(null,
						"Cannot connect to server. Please restart system.");
				e.printStackTrace();
				System.exit(0);
			}

			// Keep fetching new data every half a minute from the server.
			while (true) {
				try {
					RmiData socketData = rmi.getData(username, password);
					socketData.saveToFile();
					clientView.updateViews(); // it will automatically take the
												// data from the saved file
					Thread.sleep(30000); // check every 30 seconds
				} catch (InterruptedException | RemoteException e) {
					// If there was an error getting data from server
					JOptionPane
							.showMessageDialog(null,
									"Lost connection with server. Please restart system.");
					e.printStackTrace();
					System.exit(0);
				}
			}
		}