In a preferred embodiment of the present invention, the sending, by the first UE, data to at least one second UE by using the M resources includes determining, by the first UE, a transmit probability P, and sending the data to the at least one second UE on the M resources according to the transmit probability P, where the transmit probability P is determined according to at least one of a quantity N of available resources, a quantity N-S of unavailable resources, a proportion N/S of the available resources, a quantity c of conflicts of the first UE, a conflict time w, a service priority Q of the first UE, or a priority of the first UE.
For example, if the first UE selects 10 resources from the determined available resources, and the determined transmit probability P is 0.5, the first UE sends the data on the 10 resources according to the probability 50%. From a perspective of statistics, a discovery signal is actually sent once in every two sending opportunities.
In a preferred embodiment of the present invention, the sending, by the first UE, data to at least one second UE by using the M resources includes determining whether the first UE meets a second preset condition, and if the first UE meets the second preset condition, sending, by the first UE, the data to the at least one second UE on the M resources, or if the first UE does not meet the second preset condition, determining, by the first UE, a transmit probability P, and sending the data to the at least one second UE on the M resources according to the transmit probability P.