| Crates.io | tcp-info-sys |
| lib.rs | tcp-info-sys |
| version | 0.1.1 |
| created_at | 2025-05-09 02:38:54.9951+00 |
| updated_at | 2025-07-28 08:16:04.737106+00 |
| description | A library to get TCP_INFO from the kernel for a TCP socket |
| homepage | https://github.com/bobankh/tcp-info-sys |
| repository | https://github.com/bobankh/tcp-info-sys |
| max_upload_size | |
| id | 1666103 |
| size | 39,398 |
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.
More detailed explanation can be found in documentation.
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(())
}
You should follow our Code of Conduct.
See CONTRIBUTING GUIDELINES for contributing conventions.
Make sure to pass all the tests before submitting your code.
Apache-2.0 © BobAnkh