0

I have a java server. This server is used with my android application, the application takes in sound (microphone) and streams it directly to the server and out from the computer server. However I have this error when I try to run the server.

Exception in thread "main" java.net.BindException: Address already in use: Cannot bind
    at java.net.DualStackPlainDatagramSocketImpl.socketBind(Native Method)
    at java.net.DualStackPlainDatagramSocketImpl.bind0(Unknown Source)
    at java.net.AbstractPlainDatagramSocketImpl.bind(Unknown Source)
    at java.net.DatagramSocket.bind(Unknown Source)
    at java.net.DatagramSocket.<init>(Unknown Source)
    at java.net.DatagramSocket.<init>(Unknown Source)
    at java.net.DatagramSocket.<init>(Unknown Source)
    at com.datagram.Server.main(Server.java:28)

I am trying to use this code.

Community
  • 1
  • 1
  • 1
    It means something else is using whatever port you are trying to bind your socket to. – Jason C Apr 09 '14 at 02:49
  • So do I use another port? – Michelle Lee Apr 09 '14 at 02:57
  • That would be the immediate thing to try, but it would be better if you figured out what was using that port in the first place (which could be other applications, or even code in your same application that is incorrectly trying to bind to the same port twice). – Jason C Apr 09 '14 at 02:58
  • It is likely that you already have an instance of your server running. You should close all instances of your server and then try running again. If you are using eclipse, it may be easy to do from the console window. – Katedral Pillon Apr 09 '14 at 03:05
  • I see, the problem might be cause I clicked "Run" twice. However my Android app doesn't work when I press start, using the code from the link above, but it seems fine when the one who coded. – Michelle Lee Apr 09 '14 at 03:22

0 Answers0