aspose file tools*
The moose likes Applets and the fly likes browser running in background Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "browser running in background" Watch "browser running in background" New topic
Author

browser running in background

Stephanie Grasson
Ranch Hand

Joined: Jun 14, 2000
Posts: 347
Hi all.
I am very confused and hope you can help me.
I have an applet that extends class Applet and talks to a remote server via sockets. I use the same basic protocol as in Sun's tutorial on sockets (make the connection to the remote machine, open input and output streams and talk back and forth). In general, this works fine. I check for all possible exceptions and get the behavior I expect from the server.
I have a disconnect button in my applet. When the user clicks this button, the applet:
(1) sends a disconnect message to the server.
(2) closes its input stream
(3) closes its output stream
(4) closes its socket.
This is the exact reverse order from which they were opened.
Now, here is the problem. Sometimes, and I am not sure why,
I will hit the disconnect button and then close my browser. This works and there are no errors or warnings. The browser disappears from the screen. However, the browser doesn't really close. It is still running somewhere in the background. I have to go in and kill it with the Task Manager.
I fear there is some sort of cleanup I need to do which I am neglecting. It is the only explanation I can come up with, but I don't know why this is occurring. Just to be safe, I added the calls to disconnect from the server and close the streams and sockets to my applet's destroy() method (in case the user forgot to disconnect using the button).
I am using JDK 1.2.2 on a WindowsNT 4.0 system. The browser which has this behavior is Netscape 4.73.
If anyone has any advice or insight I would really appreciate it.
Thanks in advance.
Stephanie
Matt Midcap
Sheriff

Joined: Jan 07, 1999
Posts: 440
Hi Stephanie,
I am wondering if this is really an applet problem. The reason is because about one out of every ten times that I close Netscape (without applets running), I get the exact same browser behaviour. I havn't looked at Netscape's support site yet but I'm guessing that this may very well be a browser issue.
Does your problem happen when you run it in IE? Let me know and I'll investigate Netscape and see if this type of bug has been reported.
Talk to you soon,
Matt


Best Regards,<br />Matt Midcap
Stephanie Grasson
Ranch Hand

Joined: Jun 14, 2000
Posts: 347
Matt,
Thank you very much for your reply! At least now I know I'm not the only one this is happening to.
I tried your suggestion about using IE and it does NOT seem to exhibit this problem behavior. Unfortunately, most of our users use Netscape, so I do need to track the problem down and solve it for that browser.
I tried digging into Netscape's documentation on known bugs, but didn't find any matches yet.
If you hear of anything, I would really appreciate your input.
Thanks again.
Stephanie
Matt Midcap
Sheriff

Joined: Jan 07, 1999
Posts: 440
Hi Stephanie,
I can't find the bug on Netscape's site either. Another suggestion is to make sure that you are overriding the stop() method in your applet to explicitly stop any threads in the applet. Otherwise they will continue to run and consume browser cycles even after you leave the page.
Hope this helps!
Matt
[This message has been edited by Matt Midcap (edited August 31, 2000).]
Stephanie Grasson
Ranch Hand

Joined: Jun 14, 2000
Posts: 347
Matt,
Thanks for your efforts.
I did try Netscape's free email help, which claims to give you a response within 24 hours. (That was days ago, and I haven't received a response, but you really can't complain about a browser that you can download for free).
Anyway, I did try overriding the stop() method, but to no avail. I still have the sporadic browser-running-in-background problem. If you hear of or think of any other solutions, I would really appreciate your input.
Thanks again.
Stephanie
sanjay marjara
Greenhorn

Joined: Sep 22, 2000
Posts: 7
Originally posted by Stephanie Grasson:
Hi all.
I am very confused and hope you can help me.
I have an applet that extends class Applet and talks to a remote server via sockets. I use the same basic protocol as in Sun's tutorial on sockets (make the connection to the remote machine, open input and output streams and talk back and forth). In general, this works fine. I check for all possible exceptions and get the behavior I expect from the server.
I have a disconnect button in my applet. When the user clicks this button, the applet:
(1) sends a disconnect message to the server.
(2) closes its input stream
(3) closes its output stream
(4) closes its socket.
This is the exact reverse order from which they were opened.
Now, here is the problem. Sometimes, and I am not sure why,
I will hit the disconnect button and then close my browser. This works and there are no errors or warnings. The browser disappears from the screen. However, the browser doesn't really close. It is still running somewhere in the background. I have to go in and kill it with the Task Manager.
I fear there is some sort of cleanup I need to do which I am neglecting. It is the only explanation I can come up with, but I don't know why this is occurring. Just to be safe, I added the calls to disconnect from the server and close the streams and sockets to my applet's destroy() method (in case the user forgot to disconnect using the button).
I am using JDK 1.2.2 on a WindowsNT 4.0 system. The browser which has this behavior is Netscape 4.73.
If anyone has any advice or insight I would really appreciate it.
Thanks in advance.
Stephanie

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: browser running in background