This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

java.net.BindException: Address already in use  RSS feed

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

As i have mentioned in the above post :

in the first deploy of the war file , it works fine but whenever i redeploy the war file


i will get the error : java.net.BindException: Address already in use

it seems that port will be still opened even so if I undeploy the war file


important points to mention :
1) this problem does not arise under windows
2)this problem appears under linux : after undeploy of the war file i used to check whether the port still in use or not using 2 following commands
a) it will be still listening if i use the command
#netstat -anp | grep 11900
tcp 0 0 0.0.0.0:11900 0.0.0.0:* LISTEN -

b) the port appears to be unused if i use the command
#lsof -i:11900


any one tell me how to fix the issue

here is the full code :

TCPServerServlet.java





TCPServer.java



ServerDataEvent.java



RspHandler.java



NioServer.java





EchoWorker.java




ChangeRequest.java
 
Suresh Khant
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All ,
I was trying to post reply to my old post : http://www.coderanch.com/t/485410/sockets/java/server-not-accept-all-clients
but accidently new post created (This is just to inform you that i did not intend to post something duplicates)


Thanking all for understanding , I am stuck in this issue ...........
 
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is too much of code here to read.

In order to find out why your server did not shutdown, you would probably have to do a remote debug and find out whether the shutdown call reached the server.
If you feel the threads did not get interrupted, take a jstack of the process and see where the threads are stuck.

I would recommend using a library such as netty if you are trying to write an NIO server, instead of re-inventing the wheel.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!