Difference between linux write and sendfile syscall

Im a web programming server (C) that should send large files. My question is: What are the main differences between the two system calls: writeand sendfile. sendfiledepends on the size of the system socket buffer? I noticed that writeoften writes less than I asked.

For example, if many requests were received for one file: should I open it, copy it to memory and use it write, or maybe I can do it sendfilefor each client?

Thanks for all the answers.

+3
source share
1 answer

Read sendfile(2).

sendfile() . , sendfile() , read (2) write (2), .

write/read/senfile , //

+6

Source: https://habr.com/ru/post/1743481/


All Articles