Questions tagged [sendfile]

sendfile is the general function representation of sending data/file over the network. The network may be raw tcp sockets or any other connection itself. This tag should be used for querying about such file sending methods defined in different web/(android etc.) frameworks

279 questions
1
vote
1 answer

Rails3+Nginx: Serving files with send_file (m4v)

I use Rails3 with Nginx. I serve files through controller:uploads action. class BannersController < ApplicationController ... # authentication def uploads send_file '{localFilePath}', :disposition => 'inline' end end I uncomment this…
xpepermint
  • 35,055
  • 30
  • 109
  • 163
1
vote
1 answer

Sending Files Directly through phone lines

As you know we can use our ADSL modems to send/receive data with high bandwidth through our phone line to/from ISP servers. I'm interested to write a program to use this capability of ADSL modem to send/receive files directly between computers (like…
Amin Fazli
  • 152
  • 7
1
vote
1 answer

Jboss AS7, APR native connectors and sendfile

I've set out on an endeavour to implement support for a feature similar to mod_xsendfile on torquebox (www.torquebox.org). Torquebox is basically a bunch of code on top of JBoss AS 7, which makes my effort kinda equivalent to making sendfile work…
Parbst
  • 93
  • 1
  • 9
1
vote
1 answer

delete the file from the server after the download is completed

I have a file server which has to be deleted after a user downloads it. I send the file with send_file, but I can't just put a File.delete(path) after that line because send_file returns immediatly, so the file is deleted even before the user…
shonali
  • 11
  • 3
1
vote
1 answer

Zero copy in sockets

I am writing a network application that will transfer data between a pair of sockets. Whenever some data is available in the source socket, it will transfer it to the destination socket and vice versa. But here I am looking for the most efficient…
1
vote
0 answers

When csum_partial_copy_from_user() is called during a sendfile

Here is something I googled: sendfile() is like write(), only directly from descriptor to a socket. That eliminates copying the data from the buffer cache to a buffer in user space. Current NICs can do scatter-gather I/O, i.e. they can take the…
sliter
  • 1,063
  • 1
  • 17
  • 34
1
vote
1 answer

C - copy local file using sendfile, should I check sent bytes?

I copy file on linux with sendfile. Below is the example how I use it struct stat statBuf; fstat(fdFrom, &statBuf); sendfile(fd, fdFrom, 0, statBuf.st_size); close(fd); close(fdFrom); Documentation to sendfile says that it may not write all bytes…
user1063364
  • 791
  • 6
  • 21
1
vote
1 answer

Playing an MP3 through Ruby on Rails in chrome

I'm writing a Ruby on Rails application which allows a user to upload an mp3 file, then play it back. I have it working to the point where a user can do those things, BUT there is an issue when seeking through the song. If a user seeks ahead (or…
Garrett
  • 146
  • 2
  • 6
1
vote
1 answer

Why with sendfile() I get [EINVAL Invalid argument], but read() works good (file to socket)?

I try to send a file into the socket using the system call sendfile(), but get the error: ERROR sendfile: [EINVAL Invalid argument]. But the call read() works perfectly with the same arguments. I also tried to give to sendfile() two files…
kancler
  • 81
  • 1
  • 8
1
vote
0 answers

NGINX sendfile and gzip

The NGINX documentation says: Note, however, that because data copied with sendfile() bypasses user space, it is not subject to the regular NGINX processing chain and filters that change content, such as gzip. When a configuration context includes…
NicoAdrian
  • 946
  • 1
  • 7
  • 18
1
vote
1 answer

How is splice() actually doing zero-copy in Linux?

I'm new to the concept of zero-copy but from what I understand, it is a way not to copy anything from kernel buffers to user buffers and pass data directly between the 2 kernel buffers. In this way, the CPU does not have to do 2 copies of data from…
1
vote
1 answer

Serving Binary files using HttpLIstener

I am trying to make a httplistener server in c# that sends files to the client (who is on a browser). This is my code: static void SendFile(HttpListenerResponse response, string FileName, string ContentType) { response.ContentType =…
Caleb Liu
  • 627
  • 5
  • 18
1
vote
0 answers

When I send file, the response returns empty object in React

I have a problem with sending files in React. So, I have a big form. All data send, but files send empty object, not binary files. I use Formik and Dropzone. Result Some part of Formik and request. Jsondata is that some of the values need to change…
Rahil Əliyev
  • 247
  • 2
  • 8
1
vote
1 answer

How to send .mp4 file over TCP in C/C++?

I am trying to send files over TCP client/server in C++ app. The scenario is pretty simple; Client side send files and server side receive files. I can send text based(such as .cpp or .txt) files successfully, but when I try to send files such as…
Purgoufr
  • 761
  • 14
  • 22
1
vote
0 answers

Add header from backend to Nginx X-Accel-Redirect response

Problem: I have a backend server, with an Nginx reverse-proxy, and a file store in S3. Current behaviour is: Request comes from client Through Nginx to backend Backend returns response with X-Accel-Redirect header, pointing to S3 Nginx internally…
Alex
  • 2,270
  • 3
  • 33
  • 65