Reputation: 1707
I have a JavaApplet running in Firefox, when I refresh the page, the JavaApplet reloads, but I am getting the following error:
java.net.BindException: Address already in use: JVM_Bind
at java.net.DualStackPlainSocketImpl.bind0(Native Method)
at java.net.DualStackPlainSocketImpl.socketBind(Unknown Source)
at java.net.AbstractPlainSocketImpl.bind(Unknown Source)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
I have ServerSocket.close(); in finally like everywhere. Not sure what I am missing, please help.
Upvotes: 1
Views: 216
Reputation: 147154
The PlugIn doesn't immediately stop threads, and even when it does it's problematic how to do that. You should override an Applet
lifecycle method. I think that's the stop
method. Probably start again in start
, but I forget browsers peculiarities (should be quite uniform since Java Activator). Of course, binding to a server socket on a specific address isn't very applet friendly.
Upvotes: 1