Re: sockets,threads and interupts

2012-09-05 Thread Bryan
loial wrote: > 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. > > As I understand it signal only works in the main thread

Re: sockets,threads and interupts

2012-09-05 Thread Ramchandra Apte
On Wednesday, 5 September 2012 21:29:12 UTC+5:30, Ramchandra Apte wrote: > On Wednesday, 5 September 2012 18:34:32 UTC+5:30, Chris Angelico wrote: > > > On Wed, Sep 5, 2012 at 10:54 PM, Ramchandra Apte > > wrote: > > > > > > > At least on Linux, if you kill a process using sockets, it takes

Re: sockets,threads and interupts

2012-09-05 Thread Ramchandra Apte
On Wednesday, 5 September 2012 18:34:32 UTC+5:30, Chris Angelico wrote: > On Wed, Sep 5, 2012 at 10:54 PM, Ramchandra Apte > wrote: > > > 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 > > resour

Re: sockets,threads and interupts

2012-09-05 Thread Chris Angelico
On Wed, Sep 5, 2012 at 10:54 PM, Ramchandra Apte wrote: > 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. Err, that's

Re: sockets,threads and interupts

2012-09-05 Thread Ramchandra Apte
On Wednesday, 5 September 2012 11:26:16 UTC+5:30, Dieter Maurer wrote: > loial 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

Re: sockets,threads and interupts

2012-09-04 Thread Dieter Maurer
loial 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 automatic

Re: sockets,threads and interupts

2012-09-04 Thread Ramchandra Apte
On Tuesday, 4 September 2012 23:41:13 UTC+5:30, Grant Edwards wrote: > On 2012-09-04, MRAB wrote: > > > On 04/09/2012 16:26, loial wrote: > > >> I have threaded python script that uses sockets to monitor network > > >> ports. > > >> > > >> I want to ensure that the socket is closed cleanly i

Re: sockets,threads and interupts

2012-09-04 Thread Grant Edwards
On 2012-09-04, MRAB wrote: > On 04/09/2012 16:26, loial wrote: >> 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.

Re: sockets,threads and interupts

2012-09-04 Thread MRAB
On 04/09/2012 16:26, loial wrote: 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. As I understand it signal only works in the

sockets,threads and interupts

2012-09-04 Thread loial
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. As I understand it signal only works in the main thread, so how can I trap in