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.

4

1 回答 1

0

您正在寻找的是拦截系统信号。

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

于 2013-06-14T15:48:48.103 回答