Separated buffering and socket writing.