# tcp-info-sys
[](https://github.com/BobAnkh/tcp-info-sys)
[](https://crates.io/crates/tcp-info-sys)
[](https://docs.rs/tcp-info-sys)
[](https://github.com/BobAnkh/tcp-info-sys/blob/main/LICENSE)
A library to get TCP_INFO from the kernel for a TCP socket.
Provide the binding of TCP_INFO struct and a safe interface to get it from kernel with socket file descriptor.
## Examples
More detailed explanation can be found in [documentation](https://docs.rs/tcp-info-sys).
```rust
use std::io::prelude::*;
use std::net::TcpStream;
use std::os::fd::AsRawFd;
use tcp_info_sys::get_tcp_info;
fn main() -> std::io::Result<()> {
let stream = TcpStream::connect("127.0.0.1:12345")?;
let tcp_info = get_tcp_info(stream.as_raw_fd())?;
println!("TCP Info: {:?}", tcp_info);
Ok(())
}
```
## Maintainer
[@BobAnkh](https://github.com/BobAnkh)
## How to contribute
You should follow our [Code of Conduct](/CODE_OF_CONDUCT.md).
See [CONTRIBUTING GUIDELINES](/CONTRIBUTING.md) for contributing conventions.
Make sure to pass all the tests before submitting your code.
### Contributors
## LICENSE
[Apache-2.0](LICENSE) © BobAnkh