Text this: The Network Coding Algorithm Based on Rate Selection for Device-to-Device Communications