From 136d443b5c38bee96f5d995dfea3629ef07564c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 18 Jul 2019 09:59:28 +0200 Subject: Announce Ranch 2.0.0-rc.1 Adds Ranch 2.0 documentation and removes documentation for very old Cowboy and Ranch, along with Erlang.mk documentation which is available on its own website. --- .../2.0/manual/ranch_transport.sendfile/index.html | 220 +++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 docs/en/ranch/2.0/manual/ranch_transport.sendfile/index.html (limited to 'docs/en/ranch/2.0/manual/ranch_transport.sendfile') diff --git a/docs/en/ranch/2.0/manual/ranch_transport.sendfile/index.html b/docs/en/ranch/2.0/manual/ranch_transport.sendfile/index.html new file mode 100644 index 00000000..984042c2 --- /dev/null +++ b/docs/en/ranch/2.0/manual/ranch_transport.sendfile/index.html @@ -0,0 +1,220 @@ + + + + + + + + + + Nine Nines: ranch_transport:sendfile(3) + + + + + + + + + + + + + + + + +
+
+
+
+ +

ranch_transport:sendfile(3)

+ +

Name

+

ranch_transport:sendfile - Send a file on the socket

+

Description

+
+
sendfile(Transport :: module(),
+         Socket    :: ranch_transport:socket(),
+         File      :: file:name_all() | file:fd(),
+         Offset    :: non_neg_integer(),
+         Bytes     :: non_neg_integer(),
+         Opts      :: ranch_transport:sendfile_opts())
+    -> {ok, SentBytes :: non_neg_integer()} | {error, atom()}
+
+

Send a file on the socket.

+

The file may be sent full or in parts, and may be specified by its filename or by an already open file descriptor.

+

This function emulates the function file:sendfile/2,4,5 and may be used when transports are not manipulating TCP directly.

+

Arguments

+
Transport
+

The transport module.

+
+
Socket
+

The socket.

+
+
File
+

The filename or file descriptor for the file to be sent.

+
+
Offset
+

Start position in the file, in bytes.

+
+
Bytes
+

Length in bytes.

+
+
Opts
+

Additional options.

+
+
+

Return value

+

The number of bytes actually sent is returned on success inside an ok tuple.

+

An error tuple is returned otherwise.

+

Changelog

+
  • 1.6: The type of the File argument was extended. +
  • +
+

Examples

+
Implement Transport:sendfile using the fallback
+
+
sendfile(Socket, Filename) ->
+    sendfile(Socket, Filename, 0, 0, []).
+
+sendfile(Socket, File, Offset, Bytes) ->
+    sendfile(Socket, File, Offset, Bytes, []).
+
+sendfile(Socket, File, Offset, Bytes, Opts) ->
+    ranch_transport:sendfile(?MODULE, Socket,
+        File, Offset, Bytes, Opts).
+
+

See also

+

ranch_transport(3)

+ + + + + + +
+ +
+ + +

+ Ranch + 2.0 + Function Reference + +

+ + + +

Navigation

+ +

Version select

+ + +

Like my work? Donate!

+

Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and Erlang.mk is fantastic:

+
+ + + + + + + + + +

Recurring payment options are also available via BountySource. These funds are used to cover the recurring expenses like dedicated servers or domain names.

+ + + +
+
+
+
+ + + + + + + + + -- cgit v1.2.3