Closed applet and servlet

Hello again!Friends, can you tell me, how can I learn in the servlet that the applet was closed. The applet was opened in the browser. Help me please.
[164 byte] By [Vovchyka] at [2007-10-2 3:00:50]
# 1

You could open a socket from the applet back to the web server machine and periodically send a message back and forth. Slightly complicated, firewalls may be a problem. Not 100% reliable either; at least in theory the user might e.g. unplug his network wire or press "sleep" on a laptop; the applet will still be running though the socket connection appears dead.

Or you could do a HTTP request from the applet's stop() or destroy() method. This is not entirely reliable; if the user somehow forcefully terminates his web browser destroy() may not be called.

The best way is not to need to know when an applet closes. Applets run on a different computer; there is no 100% reliable way to know from one computer whether some program is running on another.

sjasjaa at 2007-7-15 21:27:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Thank you, sjasja, for good answer.Can you give me a piece of advice: I have the servlet and a lot of applets(clients), when the applet is close, it stops to transfer the data, and I must delete all information about it on my servlet. What can I do?
Vovchyka at 2007-7-15 21:27:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
you do one thing...overide the destroy method of the applet.....when the browser is closed..then destroy method will be called by.. JVM at runtime..in the destroy method...design the code such that it calls ur servlet...and appropriate action can be taken :)
amit_guptaa at 2007-7-15 21:27:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Thanks a lot, amit_gupta, it's will be very excellent, but have you any ideas how to do it? And one more question: if I close my browser(Firefox :)), is the applet stay running in JVM?
Vovchyka at 2007-7-15 21:27:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
when u write ur applet class...specify the destroy method...put the relevent code in that...make a url object ..make applet to servlet communicaiot then do whatever u want to do...with that....>..when u close firefox...the jvm do not run any more.....
amit_guptaa at 2007-7-15 21:27:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

Unfortunately this approach does not work 100% of the time, it is intermittant at best.

Even non daemon threads are closed down permaturely contrary to the jvm documentation!!!!.

The release notes specify that we cant use a UI component (i.e. a dialog) in close or destroy otherwise IE hangs.

So can someone tell me how to notify the server that the applet has been closed.

Poor_Sitar_playera at 2007-7-15 21:27:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...