title: Unable to receive the data (recv in cpp) put into socket(write() in java)
body: <p>I'm new to socket programming so as to test some cases I'm using a java side client to send integer data through socket and I want ot receive that data on the server side in cpp.</p>
  
  <p>My code on client side (java) looks like</p>
  
  <pre><code>out=new DataOutputStream(s.getOutputStream());
  ar=1;
  le=1;
  out.writeInt(ar);
  out.flush(); 
  out.writeInt(le);
  out.flush();
  </code></pre>
  
  <p>and im using recv function in cpp to receive this data. the code on cpp side looks like</p>
  
  <pre><code>  if (int(recv(acceptFD, &amp;number, sizeof(int), 0)) != sizeof(int))
    {
       ALOGE ("error reading on socket: number of Args: %d,reutrned value =%d\n",number);
      return;
    }
  
    for (int i = 0; i &lt; number; i++) 
    {
      int len;
      if (recv(acceptFD, &amp;len, sizeof(int), 0) != sizeof(int)) 
      {
          ALOGE ("error reading on socket: Len of Args: expected length :%d\n",len); 
           freeDebugCallbackArgs(i, args);
          return;
      }
  </code></pre>
  
  <p>and its showing the log as</p>
  
  <blockquote>
    <p>E/RILC    (  235): error reading on socket: number of Args: 16777216, returned value =-1073741824
    E/RILC    (  235): error reading on socket: Len of Args: expected length :1075093557</p>
  </blockquote>
  
  <p>It would be a great help if someone posts an answer to this. 
  Thank you</p>