Since most email is done using TCP/IP, you can read one byte at a time if you really want to. The underlying implementation will buffer the stream for you. It is received approximately 1,400 bytes at a time off of the network. Generally, I using either std::vector<char>
or std::string
as a buffer and read one byte at a time and push_back
on to the buffer in a select()
loop with a short timeout.
I can't remember if POP includes a maximum line length or not. If it does, then you can use that as your buffer size and call reserve()
on the vector. That will minimize memory reallocations and copies that might otherwise occur.
As for which standard is most recent, http://tools.ietf.org/html/rfc2822 says that it was obsoleted by http://tools.ietf.org/html/rfc5322. I usually check http://tools.ietf.org/html/rfcXXXX
where XXXX
is the RFC number. If it is obsolete, then there is a link to the most appropriate RFC at the top.
And as a final mention, don't build a POP client for deployment without a good reason too. There are a lot of gotcha's buried in the various RFCs. It is a really good learning experience though.