Solved

java.net.BindException: Address in use: bind error

Posted on 2003-11-10
3
389 Views
Last Modified: 2006-11-17
Hi,

I get the port in use error above when implementing this line:
ServerSocket ss = new ServerSocket( portnumber);

Most likely the reason I get it because I run my program over and over as I am testing this.

I know I can restart the server or my machine to resolve this port in use, but is there a way to programmatically resolve this issue?  Thanks.

0
Comment
Question by:Mero
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
Dannin earned 40 total points
ID: 9717481
have u tried setting ss to null after your done with it before the program ends. And make sure ur closed any Socket's u may have created in the process=)
0
 
LVL 92

Assisted Solution

by:objects
objects earned 35 total points
ID: 9718407
ss has to be closed before you can open another ServerSocket on the same port.

You could open a different port each time you started the server.
0
 
LVL 92

Expert Comment

by:objects
ID: 9734971
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delete Android all or certain applications data programmatically 9 111
how to debug htl and js pages 8 57
Java syntax, or is it Selenium 6 42
wild fly 8 startup error 2 42
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question