"ErrorAddress already in use...JVM_BIND" VERY URGENT
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sanjeev_Dhiman
Posted On:   Monday, April 29, 2002 11:38 PM

hi all, its very urgent....
I have written a server for chating and it is creating a socket on localhost at port no 6668.. but whenever i run my server it show an error...Erroraddress already in use..JVM_BIND...
Even I am starting it at the first time after restarting still it is giving error..WHY ?

One thing more when i change my port to 6678 it runs for 4 to 5 times but agains it shows the same error..and again i change my port to somewhere else. WHY it is giving such and error..
pls help me. its very urgent...really very urgent !
Waiting egarly !
Thanks in advance.
Sanjeev Dhiman

Re: "ErrorAddress already in use...JVM_BIND" VERY URGENT

Posted By:   Jorgen_Nordqvist  
Posted On:   Tuesday, April 30, 2002 05:49 AM

Sanjeev,

Be aware that a socket is an operating system resource and is managed by the same. If you have an abnormal termination of your Java application then the JRE may not get the chance to close the socket properly. In that case you will have to wait for the operating system to time out the socket and return it to the pool.

If you are using Windows, use NETSTAT from the command line to see if a particular socket is in use.

Jorgen

Re: "ErrorAddress already in use...JVM_BIND" VERY URGENT

Posted By:   Simon_Ablett  
Posted On:   Tuesday, April 30, 2002 04:15 AM

Either another application is already using the port or your application keeps on creating new instances of the ServerSocket. If you create a ServerSocket object for a specific port and then create another instance of it on the same port it will return a bind exception.

First see if your application is in a loop creating new instances of the ServerSocket. Then check with your sys admin whether or not the port is in use. Remember each client will open a socket to communicate with the server. The server will however have only one ServerSocket (on a specific port). It will then call 'accept' which will return a Socket object when it detects a client trying to connect.

Regards.
About | Sitemap | Contact