0

I know that this question has already been posted, but every time the answer was that you have to bind the socket after that you have set the option setReuseAddress(true).

This is the problem, I have a thread that is always runnning, and in this thread I have the following instructions:

            tcpReceiver = new ServerSocket();
            tcpReceiver.setReuseAddress(true);
            tcpReceiver.setSoTimeout(10000);
            tcpReceiver.bind(new InetSocketAddress(10001));

Even if I set the option "reuseAddress" and then I do my bind sometimes I get the so famous

            java.net.BindException: bind failed: EADDRINUSE (Address already in use)

Anybody know why?

Thx

axl coder
  • 739
  • 3
  • 19

0 Answers0