title: Android Asynctask Socket Connection
body: <p>I have been working on a program that sends and receives a string via socket connection to a server. I have used Asynctask to open the connection and send the appropriate commands but no matter what nothing happens! I know the command sending to the server is definitely correct and the server information is correct so I am stumped!</p>
  
  <p>Here is my java code</p>
  
  <pre><code>new internetRoutesRetrieve().execute("");
  
  private class internetRoutesRetrieve extends AsyncTask&lt;String, Void, String&gt; {
              @Override
              protected String doInBackground(String... parms) {
                  String userNameSend = userName;
                  String response = null;
                  try {
                      Socket client = new Socket("Hidden", Hidden);
                      DataOutputStream out = new DataOutputStream(client.getOutputStream());
                      DataInputStream in = new DataInputStream(client.getInputStream());
                      String command = "SEARCH " + userNameSend;
                      out.writeUTF(command);
                      out.flush();
                      String responseServer = in.readUTF();
                      out.close();
                      in.close();
                      response = responseServer;
                  } catch (UnknownHostException e) {
                      e.printStackTrace();
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
                  return response;
              }
              @Override
              protected void onPostExecute(String result) {
                       //This is always null!
                       System.out.println(result);
                   responseIds = result;
              }
              @Override 
              protected void onPreExecute() {
  
  
              }
              @Override
              protected void onProgressUpdate(Void... values) {
  
              }
          }
  }
  </code></pre>
  
  <p>My LogCat if it helps</p>
  
  <pre><code>    12-09 02:58:52.925: W/System.err(17598): java.io.EOFException
  12-09 02:58:53.056: W/System.err(17598):    at libcore.io.Streams.readFully(Streams.java:83)
  12-09 02:58:53.056: W/System.err(17598):    at java.io.DataInputStream.readFully(DataInputStream.java:120)
  12-09 02:58:53.066: W/System.err(17598):    at java.io.DataInputStream.decodeUTF(DataInputStream.java:195)
  12-09 02:58:53.066: W/System.err(17598):    at java.io.DataInputStream.decodeUTF(DataInputStream.java:190)
  12-09 02:58:53.066: W/System.err(17598):    at java.io.DataInputStream.readUTF(DataInputStream.java:186)
  12-09 02:58:53.066: W/System.err(17598):    at com.example.app.RouteSelection$internetRoutesRetrieve.doInBackground(RouteSelection.java:145)
  12-09 02:58:53.066: W/System.err(17598):    at com.example.app.RouteSelection$internetRoutesRetrieve.doInBackground(RouteSelection.java:1)
  12-09 02:58:53.066: W/System.err(17598):    at android.os.AsyncTask$2.call(AsyncTask.java:287)
  12-09 02:58:53.066: W/System.err(17598):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
  12-09 02:58:53.066: W/System.err(17598):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
  12-09 02:58:53.066: W/System.err(17598):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
  12-09 02:58:53.066: W/System.err(17598):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
  12-09 02:58:53.066: W/System.err(17598):    at java.lang.Thread.run(Thread.java:856)
  </code></pre>
  
  <p>Thanks for any help :)</p>