Abstract
A network coding method and an apparatus are disclosed. According to the network coding method, a first terminal device determines first indication information, where the first indication information indicates whether to preprocess a phase of first to-be-coded data to be sent by the first terminal device; and transmits data to a second terminal device in a same slot of a same transmission resource through an electromagnetic hypersurface array antenna, where the transmitting includes: sending third to-be-coded data to the electromagnetic hypersurface array antenna in a first slot of a second transmission resource, and receiving first network coded data from the electromagnetic hypersurface array antenna in the first slot, where the third to-be-coded data is obtained based on the first indication information and the first to-be-coded data; and obtaining second to-be-coded data from the second terminal device based on the third to-be-coded data and the first network coded data.