Send socket c ctrl + c behavior

I am running an application based on a server and another client, but I have a problem with the send command. Whenever I do ctrl+ con the client side, the send operation kills the thread that is inside and the process executes (so that several clients install the thread to which it belongs).

If the client finishes (makes the closing socket) properly, the server does not die, but when I use the ctrl+ combination con the client, both exit.

What can I do to prevent the send command from having this behavior?

Thanks at Advance

+3
source share
3 answers

beej guide . CTRL + C, SIGINT ( ).

+3

, , , : , ctrl + c, , . , , , , . , , , , ( ) .

ctrl + c, . , FIN .

. , , read() . , FIN, , , 0.

- , ( , ), SIGPIPE. .

, 2 : 1. , read() 0 . 2. SIGPIPE.

1- , .

+2

ctrl - c, SIGINT. signal() sigaction().

: ?

, , accept() recv()/read(), . ( -1), errno. errno . , , .

+1

Source: https://habr.com/ru/post/1744962/


All Articles