In the Treaty of Nanking ( 1842 ) China was compelled to open five of its ports to foreign economic and political penetration , and even to compensate the opium smugglers for their losses .
In 1842 China opened five ports to foreign penetration .