Generally, if you need to do cleanup at exit, you register a signal handler to handle the right signal, and have the signal handler explicitly do the things you want (in this case, closing the sockets).
On Fri, Dec 1, 2017 at 11:18 PM, michael <[email protected]> wrote: > If kill is used to stop a C program running on Linux that has open sockets, > the sockets get orphaned. > > How can I in the event of a ctrl-c close all sockets owned by the program > immediately? Waiting 3-10 seconds for > Linux to close the orphaned sockets is too long. > _______________________________________________ > PLUG mailing list > [email protected] > http://lists.pdxlinux.org/mailman/listinfo/plug _______________________________________________ PLUG mailing list [email protected] http://lists.pdxlinux.org/mailman/listinfo/plug
