Fix for fx-140. Reduced number of socket calls by buffering

Please review & test.
I've added buffering of socket calls.