WASHINGTON — President Obama warned on Wednesday that his administration was ready to take action against China over online attacks carried out by Beijing or its proxies, publicly raising the specter of sanctions a week before President Xi Jinping arrives in the United States for a state visit.

“We are preparing a number of measures that will indicate to the Chinese that this is not just a matter of us being mildly upset, but is something that will put significant strains on the bilateral relationship if not resolved,” Mr. Obama said in a question-and-answer session with business leaders on economic issues. “We are prepared to take some countervailing actions in order to get their attention.”

“My hope,” Mr. Obama added, “is that it gets resolved short of that.”

The remarks seemed calibrated to pressure Mr. Xi to agree to address online security concerns, which Mr. Obama said would “probably be one of the biggest topics” of the talks next week.

They also seemed to suggest that while sanctions are unlikely to be imposed on China before the summit meeting, it is increasingly likely that some penalties will be imposed afterward.