This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 19655
    
  18

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Address already in use:JVM_Bind
 
Similar Threads
Please explain me the flow of this simple prog.......
Socket problem
--Sockets in Servlets/JSP
How to get the file length before download
File transferring