Re: Sun officially deprecates Applets



Hi Jacob,

Thanks for the reply.

"Jacob" <jacob@xxxxxxxxx> wrote in message
news:xaednZkbctNN2OzYRVnzvA@xxxxxxxxxxxxxx
Andrew Thompson is a troll and is best ignored.

Fair enough, thanks for the heads-up, but you couldn't take a few minutes to
take a stab at my original question could you?

That is, "How can I best manage a tcp/ip socket network connection so that
it can persist during page changes".

Regards Richard Maher

Complete original question follows: -

Let me start by stating the basic requirement: - In a browser environment, I
wish to connect to a server (other than the html webserver that is hosting
the page) via a TCP/IP socket and exchange messages when and as needs be
but, once established, keep the connection open to the server until the
browser instance is shutdown. Ideally, I think I'm looking for something
that can work with html -> Javascript -> Java Applet. The user must ne free
to jump from page to page and tab to tab while the network connection lives.

Solution 1. Java Applet - Init() and Destroy()

Use the Init() method to create the socket and connect to the server and the
Destroy() method to close the socket. This seemed to be a perfect match to
my requirements! Until someone pointed out to me that almost all (see list
below) browsers call the Destroy() method whenever a new page is displayed
:-( This is *totally* at odds with all documentation I've seen for the
Destroy() method. What is the difference between Stop() and Destroy() if the
latter is called at *every* page change. Is it only 'cos I'm *not* using a
seperate thread for the Applet? Is there a Browser setting that controls
this?

Solution 2. Java Applet - Init() and never close.

If I ignore Destroy() altogether and simply stick a "if not
mysocket.isConnected() then" in the Init() method, and never *explicitly*
close the socket then that should work shouldn't it?

Two questions (at least) immediately spring to mind: -

(a) Will the Socket *ever* get closed (even when the browser is closed) and
the JVM collect the garbage, or will it simply leak resources until the
client runs out of sockets or memory?

(b) If the page and/or Applet is reloaded will the memory containing the
Socket structure be reinitialized and a false negative be returned to
isConnected() even though the other socket is still there?
Public/Private/Static/Session Variables needed?

Solution 3. Frames

Put the Applet in a seperate (possibly invisible) frame that is never
changed and therefore the Destroy() is never called until browser exit?

Solution BEST. *Please* tell me!

Surely this is not rocket science? I simply wish to fire up a page which
loads an applet, connect to the server, and keep that connection up and
ready for action no matter what the user does (short of closing the
browser). I simply cannot be Christopher Columbus here! Please advise how
best to achieve this functionality.

I'm not great with Java or OO code in general but for a complete discussion
of what I'm attempting you can look at the following thread: -
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1071300

Thanks!

Cheers Richard Maher

PS. Please *don't* discuss AJAX or Java Web-Start or your personal favourite
way of doing things. I know enough (barely :-) to know that my request is
both reasonable and valid; please try to anser *the question*.

List of browsers that call Destroy prematurely: -

Browser Platform Version Comment
Firefox Linux 1.5.0.8 calls destroy when change page
Netscape Linux 7.1 (very old version) calls destroy when change page
Konqueror Linux 3.0.3-13 (very old version) does not call destroy but the
page does not work!
Opera Linux 6.1 (very old version) crash!
Explorer XP 6.0 calls destroy when change page, the page does not work due
an javascript error
Opera XP 8.51 does not work due security


Richard Maher wrote:

I'm new here and don't recognize any names, so Andrew Thompson could
well be
the resident Applet Guru

Andrew Thompson is a troll and is best ignored.


.



Relevant Pages

  • Best strategy for Applets, Sockets, Frames, Destroy(), isConnected() and more . . .
    ... Let me start by stating the basic requirement: - In a browser environment, ... Java Applet - Initand Destroy ... Use the Initmethod to create the socket and connect to the server and the ... Destroy() method to close the socket. ...
    (comp.lang.java.programmer)
  • Re: IE Crashes
    ... I don't remember having any difficulty with Java plug-ins in IE. ... its stopor destroy() method and a user triggers stopor destroy ... I, too, have no choice in browser at work. ... --- ACGNJ Java Users Group ...
    (comp.lang.java.help)
  • Re: Begginers Rails Issue - destroy method being called out of the blue
    ... Strange problem, ... if they are post and it is your browser, could be browser bug, please ... if they are get requests, in your destroy action verify request method ... is post in your destroy method. ...
    (comp.lang.ruby)
  • Re: explorer 6 browser
    ... Download HiJack This!, Ad-aware, Pest Patrol and Spybot Search and Destroy. ... > Every time I open my browser my home page has changed to ... > nonsense. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: I NEED SOME HELP
    ... Sounds like browser hijacking.. ... I think CWSShredder should do it for you, ... AdAware and SpyBot Search and Destroy. ...
    (microsoft.public.security)