[−][src]Function opentls::async_io::accept
pub async fn accept<R, S, T>(
file: R,
password: S,
stream: T
) -> Result<TlsStream<T>> where
R: AsyncRead + Unpin,
S: AsRef<str>,
T: AsyncRead + AsyncWrite + Unpin,
This is supported on crate features
io-tokio
or io-async-std
only.Accept an incoming connection.
Example
use async_std::net::TcpListener; use async_std::fs::File; use opentls::async_io; let listener = TcpListener::bind("0.0.0.0:8443").await?; let (stream, _addr) = listener.accept().await?; let key = File::open("identity.pfx").await?; let stream = async_io::accept(key, "<password>", stream).await?; // handle stream here