Recently I have been reading a book about network programming with boost::asio, and from what I have understood, buffer is like any other memory space in address space of the program and we assign that to the socket so that we can do I/O operations.
The first thing I don't understand is, why do we need a separate thing called "buffer"? Why not just write the content in a string, and then when we receive put it in the string?
The second thing I don't understand is, why is char* or char[] used as a buffer, why not int[], which can store ASCII values of everything that comes through? It's just a memory, after all. I feel like I'm missing something here, please help me out.
Thirdly, why can't C++ std::string be used as a buffer? Every time, they have to be converted to C strings.