From 8459bebceb9533948193774371cbd9fd571b78ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 16 Oct 2019 09:48:31 +0200 Subject: Cowboy 2.7.0 --- docs/en/ranch/1.7/guide/transports/index.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'docs/en/ranch/1.7/guide/transports/index.html') diff --git a/docs/en/ranch/1.7/guide/transports/index.html b/docs/en/ranch/1.7/guide/transports/index.html index f7af0741..f3c97489 100644 --- a/docs/en/ranch/1.7/guide/transports/index.html +++ b/docs/en/ranch/1.7/guide/transports/index.html @@ -74,7 +74,7 @@

This section assumes that Transport is a valid transport handler (like ranch_tcp or ranch_ssl) and Socket is a connected socket obtained through the listener.

You can send data to a socket by calling the Transport:send/2 function. The data can be given as iodata(), which is defined as binary() | iolist(). All the following calls will work:

Sending data to the socket
-
@@ -88,7 +88,7 @@ http://www.gnu.org/software/src-highlite -->

Receiving data using passive mode requires a single function call. The first argument is the socket, and the third argument is a timeout duration before the call returns with {error, timeout}.

The second argument is the amount of data in bytes that we want to receive. The function will wait for data until it has received exactly this amount. If you are not expecting a precise size, you can specify 0 which will make this call return as soon as data was read, regardless of its size.

Receiving data from the socket in passive mode
-
@@ -106,7 +106,7 @@ http://www.gnu.org/software/src-highlite -->

The value of OK, Closed and Error can be different depending on the transport being used. To be able to properly match on them you must first call the Transport:messages/0 function.

Retrieving the transport's active message identifiers
-
@@ -114,7 +114,7 @@ http://www.gnu.org/software/src-highlite -->

To start receiving messages you will need to call the Transport:setopts/2 function, and do so every time you want to receive data.

Receiving messages from the socket in active mode
-
@@ -134,7 +134,7 @@ http://www.gnu.org/software/src-highlite -->

As in the previous section it is assumed Transport is a valid transport handler and Socket is a connected socket obtained through the listener.

To send a whole file, with name Filename, over a socket:

Sending a file by filename
-
@@ -142,7 +142,7 @@ http://www.gnu.org/software/src-highlite -->

Or part of a file, with Offset greater than or equal to 0, Bytes number of bytes and chunks of size ChunkSize:

Sending part of a file by filename in chunks
-
@@ -151,7 +151,7 @@ http://www.gnu.org/software/src-highlite -->

To improve efficiency when sending multiple parts of the same file it is also possible to use a file descriptor opened in raw mode:

Sending a file opened in raw mode
-
@@ -161,7 +161,7 @@ http://www.gnu.org/software/src-highlite -->

Upgrading a TCP socket to SSL

A connected TCP socket can be upgraded to a SSL socket via the function ranch_ssl:handshake/3. The socket must be in {active, false} mode before telling the client that the server is ready to upgrade in order to avoid race conditions.

Performing a TLS handshake on a TCP socket
-
-- cgit v1.2.3