[Gllug] Killing network connections
Alain Williams
addw at phcomp.co.uk
Fri Oct 12 18:11:52 UTC 2007
On Fri, Oct 12, 2007 at 06:45:23PM +0100, Robert McKay wrote:
> On 10/12/07, Tom Weissmann <trmsw at yahoo.co.uk> wrote:
> > This is more out of curiosity than necessity...
> >
> > Is it possible to close a network connection that "lsof -i" shows me
> > without sending a message to either of the processes involved? Can I
> > tell the kernel to kill it somehow?
>
> I'm not really sure what you're trying to achieve exactly.
>
> You could try something like this:
>
> gdb -p <pid>
> call close(<fd>)
> detach
>
> It won't receive any "message", but things that use network
> connections tend to check them now and again to see if they're still
> there.
Trouble with that is that if the process then opens another file/socket
it will probably get <fd>, so the select() loop that it is probably
sitting in will then return and the program will read/write to
the wrong place ... all hell will break loose.
--
Alain Williams
Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256 http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
Chairman of UKUUG: http://www.ukuug.org/
#include <std_disclaimer.h>
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list