I have learned solidity. And I have one question.

How does contract detect that Ether has been sent from one address to the other address?