socket for rust
A Rust library for socket.
Usage
Add this to your Cargo.toml
:
[]
= "0.1"
and this to your crate root:
extern crate psocket;
How to use
use TcpSocket;
use *;
use ;
use ErrorKind;
let listener = bind.unwrap;
let addr = listener.local_addr.unwrap;
let mut stream = connect.expect;
stream.set_read_timeout.expect;
let mut other_end = listener.accept.unwrap.0;
other_end.write_all.expect;
let mut buf = ;
stream.read.expect;
assert_eq!;
let start = now;
let kind = stream.read.err.expect.kind;
assert!;
assert!;
drop;
Diff with Rust TcpStream
provide more fuction about socket
// The func connect remote host asyn
;
// Get the socket fd
;
// Moves this TCP stream into or out of liner mode.
;
// The Method is set stream recv size kernel cache size.
;
// The Method is set stream send size kernel cache size.
;
// The Method is set tcp stream SO_REUSEADDR.
;
/// Provide func dtor the object but will not close socket fd.
;
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.