summaryrefslogtreecommitdiffstats
path: root/docs/en/ranch/1.6/guide
diff options
context:
space:
mode:
Diffstat (limited to 'docs/en/ranch/1.6/guide')
-rw-r--r--docs/en/ranch/1.6/guide/embedded/index.html2
-rw-r--r--docs/en/ranch/1.6/guide/internals/index.html2
-rw-r--r--docs/en/ranch/1.6/guide/listeners/index.html40
-rw-r--r--docs/en/ranch/1.6/guide/parsers/index.html6
-rw-r--r--docs/en/ranch/1.6/guide/protocols/index.html6
-rw-r--r--docs/en/ranch/1.6/guide/ssl_auth/index.html6
-rw-r--r--docs/en/ranch/1.6/guide/transports/index.html16
7 files changed, 39 insertions, 39 deletions
diff --git a/docs/en/ranch/1.6/guide/embedded/index.html b/docs/en/ranch/1.6/guide/embedded/index.html
index d16d7a15..37b45e4b 100644
--- a/docs/en/ranch/1.6/guide/embedded/index.html
+++ b/docs/en/ranch/1.6/guide/embedded/index.html
@@ -70,7 +70,7 @@
<p>As for <code>ranch_sup</code>, the child spec is simple enough to not require a convenience function.</p>
<p>The following example adds both <code>ranch_sup</code> and one listener to another application&apos;s supervision tree.</p>
<div class="listingblock"><div class="title">Embed Ranch directly in your supervision tree</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
diff --git a/docs/en/ranch/1.6/guide/internals/index.html b/docs/en/ranch/1.6/guide/internals/index.html
index a6ab295c..2ed24798 100644
--- a/docs/en/ranch/1.6/guide/internals/index.html
+++ b/docs/en/ranch/1.6/guide/internals/index.html
@@ -82,7 +82,7 @@
<p>This is especially useful if you expect many connections to be mostly idle, perhaps part of a connection pool. They can be handled by the kernel directly until they send any real data, instead of allocating resources to idle connections.</p>
<p>To enable this mechanism, the following option can be used.</p>
<div class="listingblock"><div class="title">Using raw transport options</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
diff --git a/docs/en/ranch/1.6/guide/listeners/index.html b/docs/en/ranch/1.6/guide/listeners/index.html
index 3a5bba45..5cde8f8f 100644
--- a/docs/en/ranch/1.6/guide/listeners/index.html
+++ b/docs/en/ranch/1.6/guide/listeners/index.html
@@ -80,7 +80,7 @@
<p>Ranch includes both TCP and SSL transport handlers, respectively <code>ranch_tcp</code> and <code>ranch_ssl</code>.</p>
<p>A listener can be started by calling the <code>ranch:start_listener/5</code> function. Before doing so however, you must ensure that the <code>ranch</code> application is started.</p>
<div class="listingblock"><div class="title">Starting the Ranch application</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -88,7 +88,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>You are then ready to start a listener. Let&apos;s call it <code>tcp_echo</code>. It will have a pool of 100 acceptors, use a TCP transport and forward connections to the <code>echo_protocol</code> handler.</p>
<div class="listingblock"><div class="title">Starting a listener for TCP connections on port 5555</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -99,7 +99,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>You can try this out by compiling and running the <code>tcp_echo</code> example in the examples directory. To do so, open a shell in the <em>examples/tcp_echo/</em> directory and run the following command:</p>
<div class="listingblock"><div class="title">Building and starting a Ranch example</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -107,7 +107,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>You can then connect to it using telnet and see the echo server reply everything you send to it. Then when you&apos;re done testing, you can use the <code>Ctrl+]</code> key to escape to the telnet command line and type <code>quit</code> to exit.</p>
<div class="listingblock"><div class="title">Connecting to the example listener with telnet</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -127,7 +127,7 @@ Connection closed<font color="#990000">.</font></tt></pre>
<h2 id="_stopping_a_listener">Stopping a listener</h2>
<p>All you need to stop a Ranch listener is to call the <code>ranch:stop_listener/1</code> function with the listener&apos;s name as argument. In the previous section we started the listener named <code>tcp_echo</code>. We can now stop it.</p>
<div class="listingblock"><div class="title">Stopping a listener</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -137,7 +137,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Listeners can be suspended and resumed by calling <code>ranch:suspend_listener/1</code> and <code>ranch:resume_listener/1</code>, respectively, with the name of the listener as argument.</p>
<p>Suspending a listener will cause it to stop listening and not accept new connections, but existing connection processes will not be stopped.</p>
<div class="listingblock"><div class="title">Suspending a listener</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -145,7 +145,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>Resuming a listener will cause it to start listening and accept new connections again. It is worth mentioning, however, that if the listener is configured to listen on a random port, it will listen on a different port than before it was suspended.</p>
<div class="listingblock"><div class="title">Resuming a listener</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -159,7 +159,7 @@ http://www.gnu.org/software/src-highlite -->
<p>You do not have to specify a specific port to listen on. If you give the port number 0, or if you omit the port number entirely, Ranch will start listening on a random port.</p>
<p>You can retrieve this port number by calling <code>ranch:get_port/1</code>. The argument is the name of the listener you gave in <code>ranch:start_listener/5</code>.</p>
<div class="listingblock"><div class="title">Starting a listener for TCP connections on a random port</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -178,7 +178,7 @@ http://www.gnu.org/software/src-highlite -->
<h2 id="_limiting_the_number_of_concurrent_connections">Limiting the number of concurrent connections</h2>
<p>The <code>max_connections</code> transport option allows you to limit the number of concurrent connections. It defaults to 1024. Its purpose is to prevent your system from being overloaded and ensuring all the connections are handled optimally.</p>
<div class="listingblock"><div class="title">Customizing the maximum number of concurrent connections</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -189,7 +189,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>You can disable this limit by setting its value to the atom <code>infinity</code>.</p>
<div class="listingblock"><div class="title">Disabling the limit for the number of connections</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -203,7 +203,7 @@ http://www.gnu.org/software/src-highlite -->
<p>You may not always want connections to be counted when checking for <code>max_connections</code>. For example you might have a protocol where both short-lived and long-lived connections are possible. If the long-lived connections are mostly waiting for messages, then they don&apos;t consume much resources and can safely be removed from the count.</p>
<p>To remove the connection from the count, you must call the <code>ranch:remove_connection/1</code> from within the connection process, with the name of the listener as the only argument.</p>
<div class="listingblock"><div class="title">Removing a connection from the count of connections</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -212,7 +212,7 @@ http://www.gnu.org/software/src-highlite -->
<p>As seen in the chapter covering protocols, this pid is received as the first argument of the protocol&apos;s <code>start_link/4</code> callback.</p>
<p>You can modify the <code>max_connections</code> value on a running listener by using the <code>ranch:set_max_connections/2</code> function, with the name of the listener as first argument and the new value as the second.</p>
<div class="listingblock"><div class="title">Upgrading the maximum number of connections</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -223,7 +223,7 @@ http://www.gnu.org/software/src-highlite -->
<p>By default Ranch will use 10 acceptor processes. Their role is to accept connections and spawn a connection process for every new connection.</p>
<p>This number can be tweaked to improve performance. A good number is typically between 10 or 100 acceptors. You must measure to find the best value for your application.</p>
<div class="listingblock"><div class="title">Specifying a custom number of acceptor processes</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -246,7 +246,7 @@ Ranch acceptor reducing accept rate: out of file descriptors</pre></div></div>
<p>Ranch allows you to upgrade the protocol options. This takes effect immediately and for all subsequent connections.</p>
<p>To upgrade the protocol options, call <code>ranch:set_protocol_options/2</code> with the name of the listener as first argument and the new options as the second.</p>
<div class="listingblock"><div class="title">Upgrading the protocol options</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -255,7 +255,7 @@ http://www.gnu.org/software/src-highlite -->
<p>All future connections will use the new options.</p>
<p>You can also retrieve the current options similarly by calling <code>ranch:get_protocol_options/1</code>.</p>
<div class="listingblock"><div class="title">Retrieving the current protocol options</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -265,7 +265,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Ranch allows you to change the transport options of a listener, for example to make it listen on a different port.</p>
<p>To change transport options, the listener has to be suspended first. Then you are allowed to change the transport options by calling <code>ranch:set_transport_options/2</code> with the listener name and the new transport options as arguments. After that, you can resume the listener.</p>
<div class="listingblock"><div class="title">Changing the transport options</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -273,7 +273,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>You can retrieve the current transport options by calling <code>ranch:get_transport_options/1</code>.</p>
<div class="listingblock"><div class="title">Retrieving the current transport options</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -283,7 +283,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Ranch provides two functions for retrieving information about the listeners, for reporting and diagnostic purposes.</p>
<p>The <code>ranch:info/0</code> function will return detailed information about all listeners.</p>
<div class="listingblock"><div class="title">Retrieving detailed information</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -291,14 +291,14 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>The <code>ranch:procs/2</code> function will return all acceptor or listener processes for a given listener.</p>
<div class="listingblock"><div class="title">Get all acceptor processes</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><b><font color="#000000">ranch:procs</font></b>(<font color="#FF6600">tcp_echo</font>, <font color="#FF6600">acceptors</font>)<font color="#990000">.</font></tt></pre>
</div></div>
<div class="listingblock"><div class="title">Get all connection processes</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
diff --git a/docs/en/ranch/1.6/guide/parsers/index.html b/docs/en/ranch/1.6/guide/parsers/index.html
index f5c5f8ee..b7b96715 100644
--- a/docs/en/ranch/1.6/guide/parsers/index.html
+++ b/docs/en/ranch/1.6/guide/parsers/index.html
@@ -76,7 +76,7 @@
<p>Text protocols are generally line based. This means that we can&apos;t do anything with them until we receive the full line.</p>
<p>A simple way to get a full line is to use <code>binary:split/2,3</code>.</p>
<div class="listingblock"><div class="title">Using binary:split/2 to get a line of input</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -90,7 +90,7 @@ http://www.gnu.org/software/src-highlite -->
<p>In the above example, we can have two results. Either there was a line break in the buffer and we get it split into two parts, the line and the rest of the buffer; or there was no line break in the buffer and we need to get more data from the socket.</p>
<p>Next, we need to parse the line. The simplest way is to again split, here on space. The difference is that we want to split on all spaces character, as we want to tokenize the whole string.</p>
<div class="listingblock"><div class="title">Using binary:split/3 to split text</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -111,7 +111,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Sometimes the size of the frame includes the first four bytes, sometimes not. Other times this size is encoded over two bytes. And even other times little-endian is used instead of big-endian.</p>
<p>The general idea stays the same though.</p>
<div class="listingblock"><div class="title">Using binary pattern matching to split frames</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
diff --git a/docs/en/ranch/1.6/guide/protocols/index.html b/docs/en/ranch/1.6/guide/protocols/index.html
index f002909d..97b47dc2 100644
--- a/docs/en/ranch/1.6/guide/protocols/index.html
+++ b/docs/en/ranch/1.6/guide/protocols/index.html
@@ -67,7 +67,7 @@
<p>All protocol handlers must implement the <code>ranch_protocol</code> behavior which defines a single callback, <code>start_link/4</code>. This callback is responsible for spawning a new process for handling the connection. It receives four arguments: the name of the listener, the socket, the transport handler being used and the protocol options defined in the call to <code>ranch:start_listener/5</code>. This callback must return <code>{ok, Pid}</code>, with <code>Pid</code> the pid of the new process.</p>
<p>The newly started process can then freely initialize itself. However, it must call <code>ranch:handshake/1,2</code> before doing any socket operation. This will ensure the connection process is the owner of the socket. It expects the listener&apos;s name as argument.</p>
<div class="listingblock"><div class="title">Perform the socket handshake</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -76,7 +76,7 @@ http://www.gnu.org/software/src-highlite -->
<p>If your protocol code requires specific socket options, you should set them while initializing your connection process, after calling <code>ranch:handshake/1,2</code>. You can use <code>Transport:setopts/2</code> for that purpose.</p>
<p>Following is the complete protocol code for the example found in <code>examples/tcp_echo/</code>.</p>
<div class="listingblock"><div class="title">Protocol module that echoes everything it receives</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -107,7 +107,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Special processes like the ones that use the <code>gen_statem</code> or <code>gen_server</code> behaviours have the particularity of having their <code>start_link</code> call not return until the <code>init</code> function returns. This is problematic, because you won&apos;t be able to call <code>ranch:handshake/1,2</code> from the <code>init</code> callback as this would cause a deadlock to happen.</p>
<p>Use the <code>gen_statem:enter_loop/4</code> function. It allows you to start your process normally (although it must be started with <code>proc_lib</code> like all special processes), then perform any needed operations before falling back into the normal <code>gen_statem</code> execution loop.</p>
<div class="listingblock"><div class="title">Use a gen_statem for protocol handling</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
diff --git a/docs/en/ranch/1.6/guide/ssl_auth/index.html b/docs/en/ranch/1.6/guide/ssl_auth/index.html
index 9c4208ea..7c5e2aec 100644
--- a/docs/en/ranch/1.6/guide/ssl_auth/index.html
+++ b/docs/en/ranch/1.6/guide/ssl_auth/index.html
@@ -90,7 +90,7 @@
<h2 id="_transport_configuration">Transport configuration</h2>
<p>The SSL transport does not request a client certificate by default. You need to specify the <code>{verify, verify_peer}</code> option when starting the listener to enable this behavior.</p>
<div class="listingblock"><div class="title">Configure a listener for SSL authentication</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -109,7 +109,7 @@ http://www.gnu.org/software/src-highlite -->
<h2 id="_authentication">Authentication</h2>
<p>To authenticate users, you must first save the certificate information required. If you have your users&apos; certificate files, you can simply load the certificate and retrieve the information directly.</p>
<div class="listingblock"><div class="title">Retrieve the issuer ID from a certificate</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -123,7 +123,7 @@ http://www.gnu.org/software/src-highlite -->
<p>To retrieve the <code>IssuerID</code> from a running connection, you need to first retrieve the client certificate and then extract this information from it. Ranch does not provide a function to retrieve the client certificate. Instead you can use the <code>ssl:peercert/1</code> function. Once you have the certificate, you can again use the <code>public_key:pkix_issuer_id/2</code> to extract the <code>IssuerID</code> value.</p>
<p>The following function returns the <code>IssuerID</code> or <code>false</code> if no client certificate was found. This snippet is intended to be used from your protocol code.</p>
<div class="listingblock"><div class="title">Retrieve the issuer ID from the certificate for the current connection</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
diff --git a/docs/en/ranch/1.6/guide/transports/index.html b/docs/en/ranch/1.6/guide/transports/index.html
index 8cdf4217..5aa88de5 100644
--- a/docs/en/ranch/1.6/guide/transports/index.html
+++ b/docs/en/ranch/1.6/guide/transports/index.html
@@ -74,7 +74,7 @@
<p>This section assumes that <code>Transport</code> is a valid transport handler (like <code>ranch_tcp</code> or <code>ranch_ssl</code>) and <code>Socket</code> is a connected socket obtained through the listener.</p>
<p>You can send data to a socket by calling the <code>Transport:send/2</code> function. The data can be given as <code>iodata()</code>, which is defined as <code>binary() | iolist()</code>. All the following calls will work:</p>
<div class="listingblock"><div class="title">Sending data to the socket</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -88,7 +88,7 @@ http://www.gnu.org/software/src-highlite -->
<p>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 <code>{error, timeout}</code>.</p>
<p>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.</p>
<div class="listingblock"><div class="title">Receiving data from the socket in passive mode</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -106,7 +106,7 @@ http://www.gnu.org/software/src-highlite -->
</ul>
<p>The value of <code>OK</code>, <code>Closed</code> and <code>Error</code> can be different depending on the transport being used. To be able to properly match on them you must first call the <code>Transport:messages/0</code> function.</p>
<div class="listingblock"><div class="title">Retrieving the transport&apos;s active message identifiers</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -114,7 +114,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>To start receiving messages you will need to call the <code>Transport:setopts/2</code> function, and do so every time you want to receive data.</p>
<div class="listingblock"><div class="title">Receiving messages from the socket in active mode</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -134,7 +134,7 @@ http://www.gnu.org/software/src-highlite -->
<p>As in the previous section it is assumed <code>Transport</code> is a valid transport handler and <code>Socket</code> is a connected socket obtained through the listener.</p>
<p>To send a whole file, with name <code>Filename</code>, over a socket:</p>
<div class="listingblock"><div class="title">Sending a file by filename</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -142,7 +142,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>Or part of a file, with <code>Offset</code> greater than or equal to 0, <code>Bytes</code> number of bytes and chunks of size <code>ChunkSize</code>:</p>
<div class="listingblock"><div class="title">Sending part of a file by filename in chunks</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -151,7 +151,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>To improve efficiency when sending multiple parts of the same file it is also possible to use a file descriptor opened in raw mode:</p>
<div class="listingblock"><div class="title">Sending a file opened in raw mode</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -161,7 +161,7 @@ http://www.gnu.org/software/src-highlite -->
<h2 id="_upgrading_a_tcp_socket_to_ssl">Upgrading a TCP socket to SSL</h2>
<p>A connected TCP socket can be upgraded to a SSL socket via the function <code>ranch_ssl:handshake/3</code>. The socket <strong>must</strong> be in <code>{active, false}</code> mode before telling the client that the server is ready to upgrade in order to avoid race conditions.</p>
<div class="listingblock"><div class="title">Performing a TLS handshake on a TCP socket</div>
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->