Patent attributes
A method includes: after receiving an operation instruction of a first user, generating, by a first device, connection information according to the operation instruction, and providing the connection information to a second device near the first device, so that the second device obtains a first identifier through calculation according to a first information portion of the connection information by using a preset algorithm; receiving a first message that is sent by the second device according to the connection information, where the first message carries the first identifier; determining whether the first identifier matches a second identifier of the first device, where the second identifier is equal to or corresponds to a result that is generated through calculation according to the first information portion; if the first identifier matches the second identifier, sending a second message to the second device; and establishing a wireless connection to the second device.