| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 |
Fixing FlashCom’s onDisconnect problem…
yes… this buggy server software is dumb to detect that the client is dead, and thus holding ghost connections.
developers are required to handle this problem by code for now… below is what i hunted down from the flashcom mailing
list:
Sometimes it takes a while for the server to understand that the client disconnected. That’s because the
operating system holds on to the socket for a while. Macs, for instance, take much longer than windows before they
decide a connection is lost. This might take a minute, maybe even longer.
If that’s too long for you, one thing you can do to make sure that a client is alive is to make a server-to-client call
to the client on a setInterval (maybe once every 10 seconds?), like this:
application.checkForAlive = function(client) {
var res = new Object();
res.client = client;
res.onResult = function(val) {
trace(”client is ok”);
}
res.onStatus = function(info) {
trace(”client didn’t respond”);
application.disconnect(this.client);
}
var executed = client.call(”areYouOk”, res);
if (executed == false) {
trace(”Client is dead, disconnecting”);
application.disconnect(client);
}
}
Then on the client:
nc.areYouOk = function() { return true; }

最新评论