changed to os default buffer size, better socket.error handling