title: JAVA - Communication Client-Server, is this approach okay?
body: <p>I need to send to a client some String objects (with java NIO using ByteBuffer), every string is formatted like this
  <code>username,tag1,tag2,tag3:</code></p>
  <p>I'm putting more strings together in a ByteBuffer like this
  <code>username1,tag1,tag2,tag3:username2,tag1,tag2,tag3:</code>
  so the client can split on &quot;:&quot; and then on &quot;,&quot; to find arguments</p>
  <p>I calculate how many complete strings can my buffer contain, and if it can't contain all my strings I  just do multiple sending.</p>
  <p>My protocol is:</p>
  <ul>
  <li>
  <ol>
  <li>Server sends to Client the number of send it will do</li>
  </ol>
  </li>
  <li>
  <ol start="2">
  <li>Client sends &quot;ok&quot; back</li>
  </ol>
  </li>
  <li>
  <ol start="3">
  <li>Server sends on the channel the content of the buffer</li>
  </ol>
  </li>
  <li>
  <ol start="4">
  <li>Client reads it and sends &quot;ok&quot;</li>
  </ol>
  </li>
  <li>
  <ol start="5">
  <li>if there are strings left repeat from point 3</li>
  </ol>
  </li>
  </ul>
  <p>My question is, is it okay to wait for my Client's feedback every time? My client needs a well formatted string, if the Server keeps putting things on the socket channel without waiting for my client to read it could happend that the client reads a bad formatted string right?</p>