Behaviours: ranch_transport.
See also: ssl.
SSL transport API.
Wrapper around ssl implementing the Ranch transport API.
This transport requires the crypto, public_key and ssl applications to be started. If they aren't started, it will try to start them itself before opening a port to listen. Applications aren't stopped when the listening socket is closed, though.accept/2 | Accept connections with the given listening socket. |
close/1 | Close the given socket. |
controlling_process/2 | Give control of the socket to a new process. |
listen/1 | Listen for connections on the given port number. |
messages/0 | Atoms used to identify messages in {active, once | true} mode. |
name/0 | Name of this transport, ssl. |
peername/1 | Return the remote address and port of the connection. |
recv/3 | Receive data from a socket in passive mode. |
send/2 | Send data on a socket. |
sendfile/2 | Send a file on a socket. |
setopts/2 | Set options on the given socket. |
sockname/1 | Return the local address and port of the connection. |
accept(LSocket::ssl:sslsocket(), Timeout::timeout()) -> {ok, ssl:sslsocket()} | {error, closed | timeout | atom() | tuple()}
Accept connections with the given listening socket.
Note that this function does both the transport accept and the SSL handshake. The returned socket is thus fully connected.See also: ssl:ssl_accept/2, ssl:transport_accept/2.
close(Socket::ssl:sslsocket()) -> ok
Close the given socket.
See also: ssl:close/1.
controlling_process(Socket::ssl:sslsocket(), Pid::pid()) -> ok | {error, closed | not_owner | atom()}
Give control of the socket to a new process.
Must be called from the process currently controlling the socket, otherwise an {error, not_owner} tuple will be returned.See also: ssl:controlling_process/2.
listen(Opts::[{backlog, non_neg_integer()} | {cacertfile, string()} | {certfile, string()} | {ciphers, [ssl:erl_cipher_suite()] | string()} | {fail_if_no_peer_cert, boolean()} | {ip, inet:ip_address()} | {keyfile, string()} | {next_protocols_advertised, [binary()]} | {nodelay, boolean()} | {password, string()} | {port, inet:port_number()} | {verify, ssl:verify_type()}]) -> {ok, ssl:sslsocket()} | {error, atom()}
Listen for connections on the given port number.
Calling this function returns a listening socket that can then The available options are:
See also: ssl:listen/2.
messages() -> any()
Atoms used to identify messages in {active, once | true} mode.
name() -> any()
Name of this transport, ssl.
peername(Socket::ssl:sslsocket()) -> {ok, {inet:ip_address(), inet:port_number()}} | {error, atom()}
Return the remote address and port of the connection.
See also: ssl:peername/1.
recv(Socket::ssl:sslsocket(), Length::non_neg_integer(), Timeout::timeout()) -> {ok, any()} | {error, closed | atom()}
Receive data from a socket in passive mode.
See also: ssl:recv/3.
send(Socket::ssl:sslsocket(), Packet::iodata()) -> ok | {error, atom()}
Send data on a socket.
See also: ssl:send/2.
sendfile(Socket::ssl:sslsocket(), Filepath::file:name()) -> {ok, non_neg_integer()} | {error, atom()}
Send a file on a socket.
Unlike with TCP, no syscall can be used here, so sending files through SSL will be much slower in comparison.See also: file:sendfile/2.
setopts(Socket::ssl:sslsocket(), Opts::list()) -> ok | {error, atom()}
Set options on the given socket.
See also: ssl:setopts/2.
sockname(Socket::ssl:sslsocket()) -> {ok, {inet:ip_address(), inet:port_number()}} | {error, atom()}
Return the local address and port of the connection.
See also: ssl:sockname/1.
Generated by EDoc, Aug 3 2013, 11:17:12.