handle socket.error while sending