The invention discloses a linux
system efficient packet receiving and sending method suitable for an industrial control environment, and the method comprises the following steps: S1, enabling a linuxsystem to carry out the caching of an
original data packet when the linux
system carries out the packet receiving operation; s2, receiving the message to a
user state through an AF _ PACKET socket; s3, enabling the kernel mode and the user mode to share a ring buffer, andcompleting packet receiving operation; s4, when the linux
system carries out packet sending operation, directly sending the
original data message, and S5, sending the data message through the kernel
protocol stack to complete the packet sending operation. According to the invention, the advantages of an AF _ PACKET packet receiving scheme and the advantages of an NFQUEUE packet sending scheme are combined, and packet receiving and sending can be carried out efficiently. A kernel
packet forwarding function is fully utilized, and packet sending
processing is carried out at a data
packet forwarding point of a kernel, so that the
processing time
delay of a
network data packet is effectively reduced, and the real-time requirement of an
industrial control system is met.