====================
:Status: Beta :Documentation: http://docs.rs/tk-listen/
A library that allows to listen network sockets with proper resource limits and error handling.
Basic challenges:
Here is the basic example:
```rust,ignore let TIMETO WAITONERROR = Duration::frommillis(100); let MAXSIMULTANEOUSCONNECTIONS = 1000;
let mut lp = Core::new().unwrap(); let listener = TcpListener::bind(&addr, &lp.handle()).unwrap(); lp.run( listener.incoming() .sleeponerror(TIMETOWAITONERROR, &h2) .map(move |(mut socket, addr)| { // Your future is here: Proto::new(socket) // Errors should not pass silently // common idea is to log them .maperr(|e| error!("Protocol error: {}", e)) }) .listen(MAXSIMULTANEOUSCONNECTIONS) ).unwrap(); // stream doesn't end in this case ```
More in docs_ and examples_
.. _docs: http://docs.rs/tk-listen/ .. _examples: https://github.com/tailhook/tk-listen/tree/master/examples
Licensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.