aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes java.net.BindException: Address already in use Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "java.net.BindException: Address already in use" Watch "java.net.BindException: Address already in use" New topic
Author

java.net.BindException: Address already in use

Suresh Khant
Ranch Hand

Joined: Feb 27, 2010
Posts: 118
Hi All,

I am working in example for the NIO socket , i have found anexample from the net and i included it in my web application ,
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


any one tell me how to fix the issue
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

Suresh Khant wrote:Hi All,

I am working in example for the NIO socket , i have found anexample from the net and i included it in my web application ,
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


any one tell me how to fix the issue


please share what example you found.
Suresh Khant
Ranch Hand

Joined: Feb 27, 2010
Posts: 118
Hi Tim , Thanks alot for the reply ,

The example i have found is Rox java nio tutorial you can get the code and examples from the link :
http://rox-xmlrpc.sourceforge.net/niotut/
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

Thanks,

How about the code to your web app? Can you show how you call this NIO stuff inside your web app?
Suresh Khant
Ranch Hand

Joined: Feb 27, 2010
Posts: 118
Hi Time,

Here is the code ,

I am calling the servlet from the web.xml

TCPServlet.java









TCPServer.java



off course the other classes and code are in the rox examples , i did not include them . I hope that you could help me to fix this issue.

Thanking you.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java.net.BindException: Address already in use