Use a buffer instead of operate on recv directly.