1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Async KCP protocol implementation based on [tokio](https://tokio.rs/).
//!
//! This module provides a fully asynchronous API for reliable UDP communication
//! using the KCP protocol, built on top of the [`core`](crate::core) module and
//! Tokio's async runtime.
//!
//! # Main Types
//!
//! - [`KcpStream`] — An async KCP connection that implements [`AsyncRead`](tokio::io::AsyncRead)
//! and [`AsyncWrite`](tokio::io::AsyncWrite). Use it like a TCP stream but over UDP.
//! - [`KcpListener`] — A server-side listener that accepts incoming KCP connections
//! on a shared UDP socket, multiplexing by `(SocketAddr, conv)`.
//! - [`KcpSessionConfig`] — Configuration combining KCP protocol parameters with
//! runtime settings (flush interval, timeout, buffer sizes).
//!
//! # Architecture
//!
//! - **Client mode**: Each [`KcpStream`] owns its own `UdpSocket` and reads
//! directly from it (`RecvMode::Socket`).
//! - **Server mode**: The [`KcpListener`] runs a background task on a shared
//! `UdpSocket`, routing incoming packets by `(SocketAddr, conv)` to per-session
//! `mpsc::channel`s (`RecvMode::Channel`).
//!
//! # Example
//!
//! ```no_run
//! use kcp_io::tokio_rt::{KcpStream, KcpListener, KcpSessionConfig};
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! // Client
//! let mut stream = KcpStream::connect("127.0.0.1:9090", KcpSessionConfig::fast()).await?;
//! stream.send_kcp(b"hello").await?;
//!
//! // Server
//! let mut listener = KcpListener::bind("0.0.0.0:9090", KcpSessionConfig::fast()).await?;
//! let (mut stream, addr) = listener.accept().await?;
//! # Ok(())
//! # }
//! ```
pub use KcpSessionConfig;
pub use ;
pub use KcpListener;
pub use ;
pub use ;