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

Asked by dairinin on 2009-01-06

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

Language:
English Edit question
Status:
Solved
For:
LinuxDC++ Edit question
Assignee:
No assignee Edit question
Solved by:
dairinin
Solved:
2009-01-07
Last query:
2009-01-07
Last reply:
2009-01-07
Razzloss (razzloss) said : #1

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.

--RZ

Steven Sheehy (steven-sheehy) said : #2

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.

dairinin (nowhere-hakkenden) said : #3

Thanks alot