sendfile() instead of read()/write()

Asked by dairinin

Is there a way to implement sendfile() system call instead of read/write? Switching to sendfile, say, in proftpd, greatly lowers CPU usage and speeds up transfers over really fast networks.

Question information

English Edit question
LinuxDC++ Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Revision history for this message
Razzloss (razzloss) said :

Of course there is a way, but with the current codebase it won't be easy. As the BufferedSocket::threadSendFile doesn't deal with file descriptors, instead it uses different types of streams. So there's no simple read/write syscall pair to replace with sendfile.

If CPU-usage is the problem and you've got plenty of bandwith try disabling compressed transfers.


Revision history for this message
Steven Sheehy (steven-sheehy) said :

sendfile() is not a POSIX API and its implementation differs between the different *NIX's. On some operating systems, files over 2GB are not supported. We may be called LinuxDC++, but we try as best we can to be portable to any OS and sendfile() is not portable.

Revision history for this message
dairinin (nowhere-hakkenden) said :

Thanks alot