| Alfonso Florio 2005-07-30, 7:45 am |
| Here's my solution to solve the problem of connections that remains alive
after disconnection...
I've noticed that just pinging is useless, cause pinging this infamous
computer that don't disconnects i receive always a true!!!!!
The situation is strange, and it's determined by the computer itself, not
by the network where is connected.
Other computers on that networks close well, and that computers don't close
also connected with other ISPs.
Anyway here's my code, I would appreciate if anybody can suggest if there
is something wrong or any optimization on it...
ON THE CLIENT:
nc.stillAlive = function() {
return ("hello");
};
SSAS:
lifeHandler = function(clientID,clientOBJ){
this.onResult = function(res){
if(res != "hello") {
application.disconnect(clientOBJ);
}
}
this.onStatus = function(info){
application.disconnect(clientOBJ);
trace("failed and got:" + info.code);
}
};
function pingalo() {
for(i=0;i<application.clients.length;i++) {
application.clients[i].call("stillAlive", new
lifeHandler(application.clients[i].name,application.clients[i]));
}
}
application.onConnect = function(client, name){
application.intervallo=setInterval(pingalo,5000);
}
application.onAppStop = function (info){
clearInterval(application.intervallo);
};
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
|