Module nexus::tcp [] [src]

TCP Reactor

The TcpReactor and TcpProtocol are a further specification of Reactors that are scoped to TCP protocols. The TcpReactor will accept all incoming connections and pass them to the protocol with the new on_connect trait method provided by the TcpProtocol trait.

Examples

extern crate mio;
extern crate nexus;

use nexus::tcp::TcpReactor;
use mio::tcp::TcpListener;

fn main() {
    let listener = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap();
    let protocol = FakeTcpProtocol;
    let mut reactor = TcpReactor::new(protocol, listener).unwrap();
    reactor.run().unwrap();
}

Structs

TcpReactor

A Reactor for TCP connections, handles accepting new connections and passing them to the protocol.

Traits

TcpProtocol

Trait used with a TCP reactor.