tcp-info-sys

Crates.iotcp-info-sys
lib.rstcp-info-sys
version0.1.1
created_at2025-05-09 02:38:54.9951+00
updated_at2025-07-28 08:16:04.737106+00
descriptionA library to get TCP_INFO from the kernel for a TCP socket
homepagehttps://github.com/bobankh/tcp-info-sys
repositoryhttps://github.com/bobankh/tcp-info-sys
max_upload_size
id1666103
size39,398
Yixin Shen (BobAnkh)

documentation

https://docs.rs/tcp-info-sys

README

tcp-info-sys

github-repo crates.io docs.rs LICENSE Apache-2.0

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.

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

How to contribute

You should follow our Code of Conduct.

See CONTRIBUTING GUIDELINES for contributing conventions.

Make sure to pass all the tests before submitting your code.

Contributors

LICENSE

Apache-2.0 © BobAnkh

Commit count: 6

cargo fmt