File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes Address already in use:JVM_Bind Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Address already in use:JVM_Bind" Watch "Address already in use:JVM_Bind" New topic
Author

Address already in use:JVM_Bind

Anchit Jindal
Greenhorn

Joined: Feb 03, 2010
Posts: 21
I am making a chat application in java. I have defined an object of Socket class in one file and want to use it in some other function in other file. For this I am passing the object of socket class as a parameter in the function call. But the function call is throwing some exception which prints the following message:

Address already in use:JVM_Bind

Please help...
Thanks a lot...
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19552
    
  16

There is already another application using the same port, or perhaps your own application has opened a server socket but never closed it.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Anchit Jindal
Greenhorn

Joined: Feb 03, 2010
Posts: 21
I am posting the code. Please tell how to remove the bug

Sunny Jain
Ranch Hand

Joined: Jul 23, 2007
Posts: 433

try this -

go to CMD prompt :

netstat -ano |find /i "50000"


it will give you a process ID, go to ask manager and see which application is using the process ID.

If it is your application means you are not closing the port properly.

Just for your information -
use java.nio packet. It better than traditional socket.


Thanks and Regards,
SCJP 1.5 (90%), SCWCD 1.5 (85%), The Jovial Java, java.util.concurrent tutorial
Roldan Baldo
Ranch Hand

Joined: Aug 11, 2009
Posts: 99
and try to change the port
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Address already in use:JVM_Bind
 
Similar Threads
File transferring
Socket problem
Please explain me the flow of this simple prog.......
--Sockets in Servlets/JSP
How to get the file length before download