The invention discloses a file sending method, a file receiving method, and a file sending and receiving device in a
user state. The file sending method includes: allocating a data reading and sending area, a data receiving and writing area, and a
data buffer area in the
user state area. Create a data sending process; Obtain the file to be sent corresponding to the data sending process from the
data buffer area; Build the
metadata of the data sending process, and
record it in the data reading and sending area ; Sequentially process one or more
metadata in the reading and sending area, wherein the
processing of the
metadata includes: sending the file to the network card through the user mode network device driver, and the file is sent by the network card issue. According to the technical solution of the present invention, the
user state space of the data sending and receiving process is used to complete the receiving and sending of data, without using the kernel
state space of the process to completely shield the kernel, which can significantly reduce
copying, context switching, and interruption. Improved data sending and receiving performance.