nb-connect
Non-blocking TCP or Unix connect.
This crate allows you to create a TcpStream
or a UnixStream
in a non-blocking way,
without waiting for the connection to become fully established.
Examples
use ;
use Duration;
// Create a pending TCP connection.
let stream = tcp?;
// Create a poller that waits for the stream to become writable.
let poller = new?;
poller.add?;
// Wait for at most 1 second.
if poller.wait? == 0 else if let Some = stream.take_error? else
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
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.