in reply to Non closing sockets - threads
#close filehandle before detached thread dies out print "closing lclient $lclient\n"; close( $lclient); #remove multi-echo-clients from echo list @clients = grep {$_ !~ $lfileno} @clients; print "exiting thread .....clients = @clients\n";
The clients are always connected to the server, except when is some network outage or other gprs disconnections. Then, clients reconnects to the server And there is my problem: Old threads remains connected to the server and I need to get rid of them!
An interesting problem, but it seems that the disconnect should be detected. I wish I had a test setup with many GPS devices to test with.
The first thing that comes to mind, is to keep a hash of connected GPS devices, tracking their id and fileno's, and check for duplicate connections in your server->accept. Another thing is maybe try a different test in your thread for being connected. The connected method returns the address if connected, so maybe you can track addresses, and be sure there are no duplicate addresses?
Maybe try a shorter timeout value? A timeout of 500 is a long time, and may be allowing your device to reconnect before the thread detects the old connection is gone?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Non closing sockets - threads
by igor1212 (Novice) on Dec 15, 2008 at 18:41 UTC | |
by zentara (Cardinal) on Dec 15, 2008 at 19:47 UTC | |
by igor1212 (Novice) on Dec 16, 2008 at 08:48 UTC | |
by zentara (Cardinal) on Dec 16, 2008 at 14:13 UTC | |
by gone2015 (Deacon) on Dec 16, 2008 at 21:00 UTC | |
by BrowserUk (Patriarch) on Dec 16, 2008 at 22:29 UTC | |
|