Struct tokio_proto::TcpServer [] [src]

pub struct TcpServer<Kind, P> { /* fields omitted */ }

A builder for TCP servers.

Setting up a server needs, at minimum:

In addition to those basics, the builder provides some additional configuration, which is expected to grow over time.

See the crate docs for an example.

Methods

impl<Kind, P> TcpServer<Kind, P> where P: BindServer<Kind, TcpStream> + Send + Sync + 'static
[src]

Starts building a server for the given protocol and address, with default configuration.

Generally, a protocol is implemented not by implementing the BindServer trait directly, but instead by implementing one of the protocol traits:

  • pipeline::ServerProto
  • multiplex::ServerProto
  • streaming::pipeline::ServerProto
  • streaming::multiplex::ServerProto

See the crate documentation for more details on those traits.

Set the address for the server.

Set the number of threads running simultaneous event loops (Unix only).

Start up the server, providing the given service on it.

This method will block the current thread until the server is shut down.

Start up the server, providing the given service on it, and providing access to the event loop handle.

The new_service argument is a closure that is given an event loop handle, and produces a value implementing NewService. That value is in turned used to make a new service instance for each incoming connection.

This method will block the current thread until the server is shut down.