File: kernel_file_sendfile_func.txt

package info (click to toggle)
erlang 1%3A27.3.4.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 225,000 kB
  • sloc: erlang: 1,658,966; ansic: 405,769; cpp: 177,850; xml: 82,435; makefile: 15,031; sh: 14,401; lisp: 9,812; java: 8,603; asm: 6,541; perl: 5,836; python: 5,484; sed: 72
file content (32 lines) | stat: -rw-r--r-- 1,342 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

  sendfile(Filename, Socket)

Since:
  OTP R15B

  Sends the file Filename to Socket. Returns {ok, BytesSent}
  if successful, otherwise {error, Reason}.

  sendfile(RawFile, Socket, Offset, Bytes, Opts)

Since:
  OTP R15B

  Sends Bytes from the file referenced by RawFile beginning at 
  Offset to Socket. Returns {ok, BytesSent} if successful,
  otherwise {error, Reason}. If Bytes is set to 0 all data
  after the specified Offset is sent.

  The file used must be opened using the raw flag, and the process
  calling sendfile must be the controlling process of the socket.
  See gen_tcp:controlling_process/2 or module socket's level 
  otp socket option controlling_process.

  If the OS used does not support non-blocking sendfile, an Erlang
  fallback using read/2 and gen_tcp:send/2 is used.

  The option list can contain the following options:

   • chunk_size - The chunk size used by the Erlang fallback to
     send data. If using the fallback, set this to a value that
     comfortably fits in the systems memory. Default is 20 MB.