On Wednesday, 5 September 2012 11:26:16 UTC+5:30, Dieter Maurer wrote: > loial <jldunn2...@gmail.com> writes: > > > > > I have threaded python script that uses sockets to monitor network ports. > > > > > > I want to ensure that the socket is closed cleanly in all circumstances. > > This includes if the script is killed or interupted in some other way. > > > > The operating system should close all sockets automatically when > > the process dies. Thus, if closing alone is sufficient...
At least on Linux, if you kill a process using sockets, it takes about 10 seconds for socket to be closed. A program should try to close all resources. OS'es may take a long time to close a unclosed socket automatically. -- http://mail.python.org/mailman/listinfo/python-list