
"Igor R"
How could i make it so i can set the buffer to use at the exact moment in which data for a new request in an already open connection begins to arrive?
You can make initial calls to async_read (or whatever read function you use) with buffer of 1 byte. When the handler is called, i.e. some data is available, you can perform "speculative" read (even synchronous) of all the data available - into any buffer you wish.
And wouldn't that affect performance in some way? I've read somewhere, that i will not be able to get just the first byte, that i would probably get some more, and so i would have to copy that extra part to the real destination buffer and then read from there on. Am i correct? Thank you for your time.