   receive buffer
  hi a common sockets principle is the receive buffer.  Does a socket wrapper have one of these I cannot find it or does anyone know of a library which has one and the functions that allows you to pop information off and do run length? Example:POP3C Read data on socketS +OK POP3 server readyC LISTS +OK 2 messages (320 octets)S 1 120S 2 342S .C RETR 1S +OK 120 octetsS datadatadata...S .because tcp can arrive fragmented, you would have to receive this into a buffer, and when it reaches the \r\n.\r\n you would pop off the buffer.  when you send the RETR 1, you would pop off the first \r\n which would be +OK 120 octects.  Then you would set the receive buffer to run length for 120 bytes and then continue.  I wrote a receive buffer a long time ago that did this but I lost it and do not want to write it again because it took me like a week and is a lot of pointer arithmetic stuff.  How can you do this with a library I cannot find one so far.   
Etwork has a receive buffer built in that is reusable.;  hmm doesnt look like what im looking for doesnt have a feature that lets you pop off an item based on a delimeter.   ;  It's just not that hard to write that kind of class. Something like the following:class buffer : public std::vector<char> {  public:    int receive_from_socket(int socket, size_t max_size) { size_t s = size(); resize(s + max_size); int r = ::recv(socket, &(*this), max_size, 0);<br> resize(s + (r &lt; 0) ? 0 : r);<br> return r;<br>    }<br>    bool get_str_delimited(std::string &out, std::string const &delim) {<br> if (size() == 0) return false;<br> if (delim.length() == 0) return false;<br> push_back(0);<br> char *str = &(*this)[0];<br> char *pos = strstr(str, delim.c_str());<br> pop_back();<br> if (pos == 0) return false;<br> out = std::string(str, pos);<br> erase(begin(), begin() + (pos - str) + delim.length());<br> return true;<br>    }<br>};<br></pre><br><br>With the proper use of existing classes, a simple buffer is a matter of minutes, not days, to implement, and &#111;nly slightly more than that to test and verify.<br><br>Note: I haven't tested it, but it should be within inches of working.