aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/guide/transports.asciidoc
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/guide/transports.asciidoc')
-rw-r--r--doc/src/guide/transports.asciidoc11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/src/guide/transports.asciidoc b/doc/src/guide/transports.asciidoc
index f5bb17e..70efa1b 100644
--- a/doc/src/guide/transports.asciidoc
+++ b/doc/src/guide/transports.asciidoc
@@ -144,6 +144,17 @@ possible to use a file descriptor opened in raw mode:
{ok, RawFile} = file:open(Filename, [raw, read, binary]),
{ok, SentBytes} = Transport:sendfile(Socket, RawFile, Offset, Bytes, Opts).
+=== 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
+[source,erlang]
+{ok, NewSocket} = ranch_ssl:handshake(Socket, SslOpts, 5000).
+
=== Writing a transport handler
A transport handler is a module implementing the `ranch_transport` behavior.