I have a project for school and I need some help. I'm working in C and I have a server and a client. In server I make a new process for each client with fork. My question is: if I close the server with CTRL+C, how do I kill all the remaining processes ? Thanks
You can store their pids after they are created and then, when quitting, signal sigterm or sigkill to them.
You can do it through shell - killall is what you are searching for under linux.
You could use threads instead of processes (could you? what do the project details say?) and communicate through variables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With