How do I use vector as input buffer for socket in C++
<p>I normally set up a huge size buffer and read data from socket and I realized that it is not a good way to read data. </p>

<p>I used to have something like this</p>

<pre><code>int bufsize = 4096;
char *buf;
int recv = read(sock, buf, bufsize)
</code></pre>

<p>I liked to use std::vector to replace the char buffer. I am not sure this is the better way though. </p>

<p>Could you please provide me sample tutorials or examples about this?</p>

<p>Thanks in advance...</p>
