socket.send - error handling improve