I wrote a telnet server in C programing language. Clients connect to the server using this command :
telnet *IP_Address*
I want when a client presses ctrl+c in its teminal, server closes the client connection but the server socket remains open. To to that put this command in first line of main function :
signal(SIGINT, CtrlC_Handler);
and this is CtrlC_Handler function :
void CtrlC_Handler(int sig) {
close(_c->_client_socket);
}
the problem is when client press ctrl-c in its terminal connection doesn't close and commandline terminal doesn't response to client :
But when the server socket is closed, client can types in terminal again. server and client are in different servers. can anybody help how can i caught ctrl+c signal in this case ?