0

im making a chat in C using TCP connection between client and server. Im running that on linux terminal.

First of all i run the server on one terminal, and then every client on another one. Everything is done except one thing.

I want that the client program will catch a click on the X button on the terminal or closing the program with CTRL+C ,and before the process die send a message to the server.

There is a way to do such thing?

Thank you, Dudu.

1 Answers1

0

What you're looking for is to intercept a System Signal.

http://en.wikipedia.org/wiki/C_signal_handling

damian
  • 1,419
  • 1
  • 22
  • 41