Question

I have a while(true) loop running for a Java server (to listen) that I am trying to learn. I utilize jGrasp for compiling and running.

After a connection is made and disconnected the server is of course still "listening"

What I would like to know is how to manualy send a break (like a ctrl-c) in jGrasp ?

I noticed that simply hitting END will stop the program but of course it will never reach the socket.close() method and this of course causes other issues.

Was it helpful?

Solution

One way of doing this would be to create a variable and set it to true and have your loop be while(variable)... Then using the debugger (not sure if you can do this in jGrasp) you can change the value of the variable (to false) mid execution if you setup a breakpoint inside the loop. After changing it on the next loop evaluation that variable will be false and it will exit the loop.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top