Hey,

following scenario:

java myServer 1337 will start a server on port 1337, the setup is done, I'm in the while(true) loop
and for each incoming connection new threads are created with the according socket, so far so good.

What I want to do is:

I have a separate thread (called keyHandler), which basically should read from stdin (Enter key)
and if that key was pressed it sends a termination notice to the main server thread.

The thread is up and running, like this:

Code:
//Initialize our thread pool//
this.pool = Executors.newCachedThreadPool();
				
//Initialize our listener for shutdown commands//
this.pool.execute(new keyHandler(this));
Now the question: How do I read from the console I started the server on from that different thread?

Thanks for help,

Regards