[][src]Module roa::tcp

This is supported on feature="tcp" only.

This module provides an acceptor implementing roa_core::Accept and an app extension.

TcpIncoming

use roa::{App, Context, Result};
use roa::tcp::TcpIncoming;
use std::io;

async fn end(_ctx: &mut Context) -> Result {
    Ok(())
}

let app = App::new().end(end);
let incoming = TcpIncoming::bind("127.0.0.1:0")?;
let server = app.accept(incoming);
// server.await
Ok(())

Listener

use roa::{App, Context, Result};
use roa::tcp::Listener;
use std::io;

async fn end(_ctx: &mut Context) -> Result {
    Ok(())
}

let app = App::new().end(end);
let (addr, server) = app.bind("127.0.0.1:0")?;
// server.await
Ok(())

Structs

TcpIncomingfeature="tcp"

A stream of connections from binding to an address. As an implementation of roa_core::Accept.

Traits

Listenerfeature="tcp"

An app extension.