private void reconnect() {
		shutdownSocket();
		if (mServer != null) {
			mServer.shutdown();
			mServer = null;
		}

		while (true) {
			try {
				mServer = new Server(mSocketAddress);
				mServer.setDaemon(true);
				mServer.start();
			} catch (Exception exception) {
				// Someone else is already the server, just start a client.
			}

			mSocket = new Socket();
			try {
				mSocket.connect(mSocketAddress);
				mInput = new DataInputStream(mSocket.getInputStream());
				mOutput = new DataOutputStream(mSocket.getOutputStream());
				return;
			} catch (Exception ex2) {
				// The server is no longer around or hasn't quite started up
				// yet, so loop and try again.
				shutdownSocket();
			}
		}
	}