Chinainfo-icon is taking an increasingly tough line on a border row with Indiainfo-icon amid a rising crescendo of nationalism in state mediainfo-icon, and President Xi Jinping looks set for an awkward encounter with Prime Minister Narendra Modi at a multilateral summit next month.

Diplomats say Beijing would like to resolve the border issue before a summit of the BRICS nations - that also groups Brazilinfo-icon, Russiainfo-icon and South Africainfo-icon - in the Chinese city of Xiamen in early September, and ensure nothing dampens what China wants to be a show of cooperation and friendship among developing countries.

But that could be tough. On Wednesday, China ramped up the rhetoric, accusing India of "concocting" excuses over the illegal entry of the South Asian nation's military into Chinese territory.

"China will take all necessary measures to safeguard its legitimate and lawful rights and interests," the Foreign Ministry said.

The two sides' troops are confronting each other close to a valley controlled by China that separates India from its close ally, Bhutaninfo-icon, and gives China access to the so-called Chicken's Neck, a thin strip of land connecting India and its remote northeastern regions.

Most previous standoffs, such as one in 2014 just ahead of a rare trip to India for Xi, were resolved with both sides withdrawing their forces. There has been no shooting since a brief border warinfo-icon in 1962.

Talks are happening behind the scenes, but with little apparent progress. Meantime, Chinese and India media have been taking a strident approach, with a Chinese state-run newspaper last week saying China could use force.

An Indian magazine's front cover last month showing a map of China shorn of Tibet and self-ruled Taiwaninfo-icon also ignited public anger on Chinese social mediainfo-icon with thousands of angry posts.

"The problem is the media on both sides are whipping things up. This makes it hard for China or India to back down," said a Beijing-based source who is familiar with the discussions between the two sides.

The Indian government has asked political parties to refrain from politicizing the issue and allow diplomacy to work. 

"Show What We Are Made of"

China's defense ministry last week also warned India not to harbor any illusions about the Chinese military's ability to defend its territory.

A source with ties to the military, who spoke recently to a senior Chinese officer involved in the stand off, said China has no appetite for conflictinfo-icon with India but could not be seen to be weak.

"Nobody wants to fight about this, but if India keeps making trouble then we'll have to show them what we're made of," the source said, citing the conversation with the senior officer.

China has repeatedly called on India to withdraw its forces.

An Indian government source closely tracking the standoff said there was no change in the ground situation in Doklam, with the two sides remaining in a standoff.

Indian military expert Nitin Gokhale said India was prepared for a long haul.

"The decision is to stay resolute on the ground and reasonable in diplomacy," Gokhale said.

China has been briefing foreign diplomats on the stand off, saying it wants a resolution but that its patience won't last for ever.

"There's no easy solution," said an Asian diplomat, who attended a briefing, referring to both sides' insistence that they are in the right.

For the time being, China looks ready to keep things calm, said another Asian diplomat, familiar with China's thinking on the issue.

"China really wants to resolve this ahead of the BRICS summit. It doesn't want anything to affect the atmosphere," the diplomat said. "The gloves could come off after the summit though."

 China and India have long been suspicious of each other, a legacy of the 1962 border war, India's playing host to exiled Tibetan spiritual leader the Dalai Lama and China's close relations with

India's regional rival Pakistaninfo-icon.India has privately raised objections to Chinese firm Shanghai Fosun Pharmaceutical Group's proposed $1.3 billion takeover of Indian drugmaker Gland Pharma, a source familiar with the matter said on Monday.

Ajit Doval, India's national security adviser, visited Beijing last week for a BRICS security meeting, and had bilateral talks with his Chinese opposite number, top diplomat Yang Jiechi, who outranks the foreign minister.

A Chinese government statement on that meeting did not mention the border issue.

China and India are already suspicious of each other because of China's massive investments in Pakistan and Sri Lankainfo-icon, including Chinese-invested ports in both countries India fears could one day become Chinese military bases, another senior Asian diplomatic source said.

"Nobody wants to get caught in the middle of this," the diplomat said, pointing to the prospect for the border tensions worsening and becoming a wider Asian security issue dragging in other countries.