title: AsyncTask, doInBackground never runs in android
body: <p>When i try to start my doinbackground to wait for an incoming message it never really run thru it just skips over it</p>
  
  <pre><code>public class Incomingdata extends AsyncTask&lt;Void,Void,Void&gt;
  {
      Socket s  ;
      String input;
  
      public Incomingdata(Socket socket)
      {   
          super();
          this.s = socket;
      }
  
      @Override
      protected Void doInBackground(Void... params) 
      {
          Log.i("ddd","Got here before try");
          try
          {   
              InputStream in = s.getInputStream();
              Scanner r = new Scanner(in);
              Log.i("Info",s.getPort()+"");
              Log.i("ddd","Got here");
              while(s.isConnected() &amp;&amp; r.hasNext())
              {
                  String input =r.nextLine(); 
              }
          }
          catch (UnknownHostException e) 
          {
                 e.printStackTrace();
          }
          catch (IOException e)
          {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          catch(NoSuchElementException e)
          {
              e.printStackTrace();
          }
          return null;
      }
  
      @Override
      protected void onPostExecute(Void input)
      {
          System.out.println("123"+input);
      }
  
  }
  </code></pre>
  
  <p>And here is my log cat</p>
  
  <pre><code> java.net.Socket.startupSocket(Socket.java:724)
  04-25 23:50:26.659: W/System.err(28882):    at java.net.Socket.&lt;init&gt;(Socket.java:263)
  04-25 23:50:26.659: W/System.err(28882):    at com.example.handy.myComs.sending_data(myComs.java:23)
  04-25 23:50:26.659: W/System.err(28882):    at com.example.handy.MainActivity.readSms(MainActivity.java:277)
  04-25 23:50:26.659: W/System.err(28882):    at com.example.handy.MainActivity$1.onClick(MainActivity.java:92)
  04-25 23:50:26.659: W/System.err(28882):    at android.view.View.performClick(View.java:2485)
  04-25 23:50:26.659: W/System.err(28882):    at android.view.View$PerformClick.run(View.java:9080)
  04-25 23:50:26.659: W/System.err(28882):    at android.os.Handler.handleCallback(Handler.java:587)
  04-25 23:50:26.659: W/System.err(28882):    at android.os.Handler.dispatchMessage(Handler.java:92)
  04-25 23:50:26.659: W/System.err(28882):    at android.os.Looper.loop(Looper.java:130)
  04-25 23:50:26.659: W/System.err(28882):    at android.app.ActivityThread.main(ActivityThread.java:3687)
  04-25 23:50:26.659: W/System.err(28882):    at java.lang.reflect.Method.invokeNative(Native Method)
  04-25 23:50:26.659: W/System.err(28882):    at java.lang.reflect.Method.invoke(Method.java:507)
  04-25 23:50:26.659: W/System.err(28882):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
  04-25 23:50:26.659: W/System.err(28882):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
  04-25 23:50:26.659: W/System.err(28882):    at dalvik.system.NativeStart.main(Native Method)
  04-25 23:50:26.729: I/System.out(28882): 123null
  </code></pre>
  
  <p>This is where i am calling it</p>
  
  <pre><code>public class myComs 
  {
      private static int i = 0;
  
      public static void sending_data(String ipAddress, String message)
      {
          try
          {
              InetAddress inet = InetAddress.getByName(ipAddress);
              Socket s = new Socket(inet, 2000);
              OutputStream o = s.getOutputStream();
              PrintWriter p = new PrintWriter(o);
              while(i&lt;1)
              {
                  new Incomingdata(s).execute();
                  i++;
              }
              p.println(message);
              p.flush();
          }
          catch (UnknownHostException e)
          {
              e.printStackTrace();
          }
          catch (IOException e)
          {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>As you can see by the 123null it never waits any help would be great as i am at this with ages and getting no where fast</p>
  
  <p>Thank you</p>
  
  <p><strong>UPDATE</strong>
  Right i got going thru and know its getting the port and but its still not waiting for incoming data its just finishing  </p>