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