public static void listen() {
		listener = new Thread() {
			@Override
			public void run() {
				try {
					while (!isInterrupted()) {
						if (rxSock == null || rxSock.isClosed()) {
							rxSock = new ServerSocket(receivePort);
						}
						try {
							waiting.add(rxSock.accept());
							
							// Handle message reception in a new thread
							new Thread() {
								@Override
								public void run() {
									synchronized (listeners) {
										for (CommsListener l : listeners) {
											l.messageReceived();
										}
									}
								}
							}.start();
						} catch (IOException ex) {
							if (!ex.getMessage().equals("socket closed")) {
								Alerter.getHandler().severe(
										"Connection Listener",
										"Unable to accept incoming message. "
												+ ex.getMessage());
							}
						}
					}
				} catch (IOException ex) {
					Alerter.getHandler().fatal(
							"Connection Listener",
							"Unable to listen for incoming messages. "
									+ ex.getMessage());
				} finally {
					if (rxSock != null) {
						try {
							rxSock.close();
						} catch (IOException ignore) {}
					}
				}
			}
		};
		listener.start();
	}