splice (file, pipefd, file_len); splice (pipefd, socket, total_len); (this is all conceptual pseudo-code, of course), and this very naturally has none of the issues that sendfile () has with plugging etc. There's never any "send header separately and do extra work to make sure it is in the same packet as the start of the data".