[PLUG] Close TCP sockets C program.

Russell Senior russell at personaltelco.net
Sat Dec 2 10:44:37 UTC 2017


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 <michael at robinson-west.com> 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
> PLUG at pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug



More information about the PLUG mailing list