title: is.readUTF() not recieving message
body: <p>For the chat program in android side I am sending message via DataInput stream as </p>
  
  <pre><code>Socket sck = new Socket();
  sck.connect(new InetAddress("192.168.1.91",1500),2000);
  
  if(sck.isConnected())
  {
      DataOutputStream os = new DataOutputStream(sck.getOutputStream());
      os.writeUTf(msg);
      System.out.println("Message sent");
  }
  </code></pre>
  
  <p>and on the Server side My code is</p>
  
  <pre><code>ServerSocket serv = new ServerSocket(1500);
  Socket sock = serv.accept();
  DataInputStream is = new DataInputStream(sock.getInputStream);    
  
  String ans = is.readUTF();
  System.out.println("Got"+ans);
  </code></pre>
  
  <p>But on server side it seems it does not received anything and still waiting for the message. But on client side It shows message sent.</p>
  
  <p>Here is my full code.</p>
  
  <pre><code>package in.prasilabs.eagleeye;
  
  import java.io.DataInputStream;
  import java.io.DataOutputStream;
  import java.io.IOException;
  import java.net.InetSocketAddress;
  import java.net.Socket;
  import java.net.UnknownHostException;
  
  public class EagleClient extends Thread
  {
  
      public int ret = 0;
      private String ip;
      private int port;
      private Socket sck;
      private boolean estb = false;
      private DataInputStream is;
      private DataOutputStream os;
      private String rmsg = null;
      private String msg;
      private String username;
      private String password;
  
      public String reply;
  
      Data dt = new Data();
  
      public EagleClient() 
      {
  
      }
      public EagleClient(String ip, int port, String username, String password)
      {
          this.ip = ip;
          this.port = port;
          this.username = username;
          this.password = password;
      }
  
      public void run()
      {
          establish();
          if(estb == true)
          {
              sendInfo(username,password);
          }
  
      }
      public void establish()
      {
          int time_out = 2000;
          try 
          {
              System.out.println("trying to connect");
              sck = new Socket();
              sck.connect(new InetSocketAddress(dt.getIp(),dt.getServerPort()),time_out);
              estb = true;
              System.out.println("Established");
  
          }
          catch (UnknownHostException e) 
          {
              ret =0;
              e.printStackTrace();
          } 
          catch (IOException e) 
          {
              ret = 0;
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          if(estb == true)
          {
              try {
                  is = new DataInputStream(sck.getInputStream());
                  os = new DataOutputStream(sck.getOutputStream());
                  dt.setOS(os);
                  dt.setIS(is);
                  System.out.println("Messages are ready to send");
              } catch (IOException e) 
              {
                  ret = 0;
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  
          }
      }
      public void sendInfo(String user,String password)
      {
          Data dt = new Data();
          is = dt.getIS();
          os = dt.getOS();
          String drport = Integer.toString(dt.getdrPort());
          try {
              os.writeUTF("logn");
              System.out.println("Sending user info");
              os.writeUTF(dt.getUsername());
              os.writeUTF(dt.getPassword());
              os.writeUTF(drport);
              reply = is.readUTF();
              if(reply.equals("success"))
                  dt.setLoginStatus(true);
              else
                  dt.setLoginStatus(false);
              System.out.println("ACk recieved");
          } catch (IOException e) {
              ret = 0;
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
      }
      public int sendMessage(String msg)
      {
          Data dt = new Data();
          os = dt.getOS();
          is = dt.getIS();
          this.msg = msg;
          try {
              os.writeUTF(msg);
              System.out.println("Client :" +msg);
              recieveMessage();
          } catch (IOException e) {
              ret = 0;
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          return ret;
      }
      public void recieveMessage()
      {
          try {
              System.out.println("Trying to get acknowledgement");
                  sck.setSoTimeout(2000);
                  rmsg = is.readUTF();
                  if(rmsg.equals(msg))
                  {
                      System.out.println("Ack recvd" +rmsg);
                      ret = 1;
                  }
                  else if(!msg.equalsIgnoreCase(rmsg))
                  {
                      //sendMessage();
                      Thread.sleep(100);
                      System.out.println("Retrying");
                      rmsg = is.readUTF();
                      System.out.println("Ack recvd" +rmsg);
                      ret = 1;
                  }
                  else
                  {
                      System.out.println("Message not recieved");
                      ret = 0;
                  }
          } catch (IOException e) {
              ret = 0;
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (InterruptedException e){
              e.printStackTrace();
          }
      }
  
  
  
  }
  </code></pre>