title: how to send on socket a vector<unsigned char>
body: <p>Im trying to do a simple client tcp (I have a server already working).
  I have defined 2 variables:</p>
  
  <ol>
  <li><code>std::vector&lt;unsigned char&gt; buffer(1000);</code></li>
  <li><p><code>std::vector&lt;std::vector&lt;unsigned char&gt;&gt; buff;</code>
  <code>buffer</code> I use it ot read chains of unsigned characters, when reading is done i store it on <code>buff</code> and I start reading again.
  I have defined all the process of adress, port, etc and when it comes to send strings of <code>buffer</code> I have problems.
  Here's what i tried so far:</p>
  
  <pre><code>while(!buff.empty()){
      // Sockets Layer Call: send(
      n = send(sockfd, buff.back(), buff.back.size(), 0);
      std::this_thread::sleep_for(std::chrono::milliseconds(delay)) ;
      buff.pop_back();
  
      if (n &lt; 0){
          std::cout&lt;&lt;"ERROR writting to socket"&lt;&lt;std::endl;
          exit(1);
      }
  }
  </code></pre></li>
  </ol>
  
  <p>I tried adding <code>(char *)</code> , also <code>reinterpret_cast</code>, but noithing seems to work. Any clue?</p>
  
  <p>Thanks</p>