title: JAVA: I can't read text from sockets, send by C++ program
body: <blockquote>
    <p><strong>Situation:</strong> I have program in JAVA and program (<strong>only exe; I can't have access inside</strong>) in C++. They are sending and receiving text for e.g. <code>"REQ", "00", "1,3", "15,4", "PAUSE"</code>. Communication goes like this (sending):</p>
  </blockquote>
  
  <pre><code>J: REQ
  C: 00
  J: NEW
  C: 10
  J: RDY
  C: 2,13
  J: 20
  C: RDY
  J: 1,1
  (...)
  </code></pre>
  
  <p>First <code>RDY</code> made a repeated commands: <code>RDY</code> <code>number,number</code> <code>20</code> <code>RDY</code> (...).</p>
  
  <p>Numbers: 0 - 15.</p>
  
  <p><strong>Receiving:</strong></p>
  
  <pre><code> char[] bb = new char[10];
   int znaki = in.read(bb);
   bb[7] = '\n';
   String s = new String(bb, 0, 7);
  </code></pre>
  
  <p><strong>Problem:</strong> I read numbers like:</p>
  
  <pre><code>Send: 2,13
  Received: 2,
  Send: 3,15
  Received 3,1
  Send: 13,2
  Received: 13,
  </code></pre>
  
  <p>But sometimes I have IOExeption: "Input length = 1"</p>
  
  <p><strong>Is there any solution, to read properly?</strong></p>