title: ServerSocket Android
body: <p>Hey community I have the following ServerSocket which should listen to port 53000 and log any received data. However, I cannot seem to get past the server.accept() blocking call.</p>
  
  <pre><code>public void run() {
  
          SocketServer server = new ServerSocket(53000);
  
  
          //---buffer store for the stream---
          byte[] buffer = new byte[1024];
          //---bytes returned from read()---
          int bytes;
  
          //---keep listening to the InputStream until an
          // exception occurs---
          while (true) {
              try {
  
                  socket = server.accept();
                  BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
  
                  String str = in.readLine();
  
                  Log.i("received response from server", str);
  
                  in.close();
                  socket.close();
  
              } catch (IOException e) {
                  Log.e(TAG, e.getMessage());
              } catch (Exception e){
                  server.close();
                  Log.e(TAG, e.getMessage());
              }
          }
  
      }
  </code></pre>
  
  <p>I have also given the application the INTERNET permission in the Manifest file. 
  ()</p>
  
  <p>To add to the mystery, I have also verified client responses get sent to that port.</p>
  
  <p>Is there something in particular I need to do to make this work? </p>
  
  <p>Thanks.</p>