Use appropriately sized send buffers for DNS messages over TCP
This commit changes send buffers allocation strategy for stream based transports. Before that change we would allocate a dynamic buffers sized at 64Kb even when we do not need that much. That could lead to high memory usage on server. Now we resize the send buffer to match the size of the actual data, freeing the memory at the end of the buffer for being reused later.
Closes #4038 (closed)