title: java.net.BindException: bind failed: EADDRINUSE
body: <p>I am new to android and i am trying to create a server socket . the code follows.</p>
  
  <p>i am getting the warning continuously . can it be fixed ? can i ignore it?</p>
  
  <pre><code>03-28 15:47:34.460: W/System.err(3185): java.net.BindException: bind failed: EADDRINUSE (Address already in use)
  
  03-28 15:47:34.460: W/System.err(3185):     at libcore.io.IoBridge.bind(IoBridge.java:89)
  
  03-28 15:47:34.460: W/System.err(3185):     at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:150)
  
  03-28 15:47:34.460: W/System.err(3185):     at java.net.ServerSocket.&lt;init&gt;(ServerSocket.java:100)
  
  03-28 15:47:34.470: W/System.err(3185):     at java.net.ServerSocket.&lt;init&gt;(ServerSocket.java:69)
  
  03-28 15:47:34.470: W/System.err(3185):     at &lt;path&gt;$server.run(&lt;filename&gt;.java:302)
  
  03-28 15:47:34.470: W/System.err(3185):     at java.lang.Thread.run(Thread.java:856)
  03-28 15:47:34.470: W/System.err(3185): Caused by: libcore.io.ErrnoException: bind failed: EADDRINUSE (Address already in use)
  
  03-28 15:47:34.470: W/System.err(3185):     at libcore.io.Posix.bind(Native Method)
  03-28 15:47:34.470: W/System.err(3185):     at ibcore.io.ForwardingOs.bind(ForwardingOs.java:39)
  03-28 15:47:34.470: W/System.err(3185):     at libcore.io.IoBridge.bind(IoBridge.java:87)
  03-28 15:47:34.470: W/System.err(3185):     ... 5 more
  
  03-28 15:47:34.470: W/System.err(3185): java.lang.NullPointerException
  03-28 15:47:34.490: W/System.err(3185):     at &lt;path&gt;Provider$server.run(&lt;filename&gt;.java:315)
  
  03-28 15:47:34.490: W/System.err(3185):     at java.lang.Thread.run(Thread.java:856)
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>class server implements Runnable {
  
          public void run() {
  
  
          ServerSocket serverSocket = null;
              try {
                  serverSocket = new ServerSocket(10000);
              } catch (IOException e2) {
                  // TODO Auto-generated catch block
                  e2.printStackTrace();
              }
              //  Log.d("Recieving ", "Server Socket Created");
  
  
              try {
                  while(true) {
                      // Blocks until a connection occurs:
                      try {
  
                  Socket client = serverSocket.accept();
                          //Log.d("Recieving ", "Client request accepted");
                          str_proc tk = new str_proc(client);
                          tk.start();
  
                      } catch (IOException e1) {
  
                          // TODO Auto-generated catch block
                          e1.printStackTrace();
                          Log.d("Recieving ", "Problem creating socket for listening");
  
                      }
                  }//while true loop ends
  
              }catch (Exception e){
                  e.printStackTrace();
              }
          }
  }
  </code></pre>