Skip to main content

Crate kcp_io

Crate kcp_io 

Source
Expand description

§kcp-io

A Rust wrapper for the KCP protocol, providing FFI bindings, a safe API, and async tokio integration.

§Features

  • kcp-sys — Raw FFI bindings to the KCP C library
  • kcp-core — Safe Rust wrapper (implies kcp-sys)
  • kcp-tokio — Async tokio integration (implies kcp-core, enabled by default)

§Quick Start

use kcp_io::tokio_rt::{KcpStream, KcpSessionConfig};

let mut stream = KcpStream::connect("127.0.0.1:8080", KcpSessionConfig::fast()).await?;
stream.send_kcp(b"hello").await?;

let data = stream.recv_kcp().await?;
println!("Received: {:?}", data);

Re-exports§

pub use tokio_rt::KcpListener;
pub use tokio_rt::KcpSessionConfig;
pub use tokio_rt::KcpStream;
pub use tokio_rt::KcpTokioError;
pub use tokio_rt::KcpTokioResult;
pub use core::Kcp;
pub use core::KcpConfig;
pub use core::KcpError;
pub use core::KcpResult;

Modules§

core
Safe Rust wrapper for the KCP protocol.
sys
Raw FFI bindings to the KCP C library.
tokio_rt
Async KCP protocol implementation based on tokio.