Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Address already in use:JVM_Bind

 
Anchit Jindal
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20613
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is already another application using the same port, or perhaps your own application has opened a server socket but never closed it.
 
Anchit Jindal
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am posting the code. Please tell how to remove the bug

 
Deepak Chopra
Ranch Hand
Posts: 433
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Roldan Baldo
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and try to change the port
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic