So, I am writing a simple server-client program for school. The client sends a command and some parameters, and the server returns a response.
The server will listen for new connections and create a stream for each new client connection. The server listener is also an independent thread, which is initiated by the main one.
The server part of Main waits for user input and exits when it receives the corresponding input.
In a way, the server listener runs in a loop that says
while(true) { ... }
So, when main reaches the end of the program and exits, will it kill all running threads? Or will he wait for their completion?
If this is the last case, is there some method I can call that will return true if the system tries to exit?
Please keep in mind that each component is part of its own class.
source share