sendfile

Is writing to a socket an arbitrary limitation of the sendfile() syscall?

Prelude sendfile() is an extremely useful syscall for two reasons: First, it's less code than a read()/write() (or recv()/send() if you prefer that jive) loop. Second, it's faster (less syscalls, implementation may copy between devices without buffer, etc...) than the aforementioned methods. Less code. More efficient. Awesome. In U...

sendfile() usage on two mmaped files (linux)

Hello Can sendfile() linux syscall be used to send part of file from one mmaped file to other mmaped file? ...

Differnce between linux write and sendfile syscall

Im programming webserver (C), which should send big files. My question is: What are the main differences in two syscalls: write and sendfile. Does sendfile depends on size of socket system buffer? I noticed that write often writes less then I requested. For example, if got many requests for one file: should i open it, copy into memory a...

Terminology: opposite of "zero copy"?

We're benchmarking some code that we've converted to use sendfile(), the linux zero-copy system call. What's the term for the traditional read()/write() loop that sendfile() replaces? I.e., in our report I want to say "zerocopy is X millisecs, and ??? is Y millisecs." What word/phrase should I use? ...

Invalid argument in sendfile() with two regular files

I'm trying to test the sendfile() system call under Linux 2.6.32 to zero-copy data between two regular files. As far as I understand, it should work: ever since 2.6.22, sendfile() has been implemented using splice(), and both the input file and the output file can be either regular files or sockets. The following is the content of sendf...

Django download file empty

I am writing a simple function for downloading a certain file, from the server, to my machine. The file is unique represented by its id. The file is locatd corectly, and the download is done, but the downloaded file (though named as the one on the server) is empty. my download function looks like this: def download_course(request, id):...

send_data just sends an empty file

Hi There, Im looking for a way to download a xml file. I use: file_path = 'folder/' + xml_name + '.xml' send_file file_path, :type => "text/xml" but this always downloads me an empty file. The file itself has 16 KB of data in it... why is that? Maechi ...

rails how to know when send_file done

As it takes some time to prepare the content of the data to be downloaded, I want to show a message "Preparing file to download" when the user submits the request Then when the file is ready, I use send_file to send the data Once it's done, I need to clear the message Thanks a lot ...

With sendfile(), is it possible to tell when in_fd is at EOF?

Reading through the man page of the Linux system call sendfile, I am wondering whether it is possible for the calling program to know when in_fd is at EOF. Presumably, this could be signaled by a return value of 0, but this leads to the question of what a return value of 0 actually means. If sendfile is like write, then a return value of...