i want to sent string from android device to java desktop application im using following code
<p>In android device which is client i use following code</p>

<pre><code>sock = new Socket("10.0.2.2", 3390);        
   // r = new BufferedReader(new InputStreamReader(sock.getInputStream()));
    out = new BufferedWriter(new OutputStreamWriter(sock
        .getOutputStream()));
    String s = "abc";
    out.write(s);
</code></pre>

<p>while in server side which is java desktop application i use following code</p>

<pre><code>         InputStream m_Input = null;
    ServerSocket MyService = null;
try {
   MyService = new ServerSocket(3390);
  serviceSocket = MyService.accept();
   m_Input = serviceSocket.getInputStream();
    }
    catch (IOException e) {
       System.out.println(e);
    }
</code></pre>

<p>when i run both the client side i.e android does not send request to server
 for reading data i use follwoing code</p>

<pre><code>byte[] data = null;
 try
   {
    int ch = 0;
      int length = m_Input.read();
    if (length &gt;0)
      data= new byte[length];
      length = 0;

      while (length != data.length)
      {
               ch = m_Input.read(data, length, data.length-length);

              if (ch == -1)
              {
               //   System.out.println("ch is 0");
               break;

              }
              length +=ch;
      }


   }
   catch (IOException e)
   {
        System.err.println(e);
   }


   return new String(data);


  }
</code></pre>
