added socket buffering mechanism