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
|
[;1m sendfile(Filename, Socket)[0m
[;;4mSince[0m:
OTP R15B
Sends the file [;;4mFilename[0m to [;;4mSocket[0m. Returns [;;4m{ok, BytesSent}[0m
if successful, otherwise [;;4m{error, Reason}[0m.
[;1m sendfile(RawFile, Socket, Offset, Bytes, Opts)[0m
[;;4mSince[0m:
OTP R15B
Sends [;;4mBytes[0m from the file referenced by [;;4mRawFile[0m beginning at [;;4m[0m
[;;4mOffset[0m to [;;4mSocket[0m. Returns [;;4m{ok, BytesSent}[0m if successful,
otherwise [;;4m{error, Reason}[0m. If [;;4mBytes[0m is set to [;;4m0[0m all data
after the specified [;;4mOffset[0m is sent.
The file used must be opened using the [;;4mraw[0m flag, and the process
calling [;;4msendfile[0m must be the controlling process of the socket.
See [;;4mgen_tcp:controlling_process/2[0m or module [;;4msocket[0m's level [;;4m[0m
[;;4motp[0m socket option [;;4mcontrolling_process[0m.
If the OS used does not support non-blocking [;;4msendfile[0m, an Erlang
fallback using [;;4mread/2[0m and [;;4mgen_tcp:send/2[0m is used.
The option list can contain the following options:
• [;;4mchunk_size[0m - 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.
|