File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Address already in use:JVM_Bind" Watch "Address already in use:JVM_Bind" New topic

Address already in use:JVM_Bind

Anchit Jindal

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

Joined: Oct 27, 2005
Posts: 20271

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

How To Ask Questions How To Answer Questions
Anchit Jindal

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

Deepak Chopra
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
I agree. Here's the link:
subject: Address already in use:JVM_Bind
It's not a secret anymore!