A C ARQ protocol that cuts latency versus TCP at modest bandwidth cost, integrated via callbacks without internal syscalls.
Overview
KCP is a reliable ARQ protocol designed for lower average latency than TCP on lossy or jittery networks, trading roughly ten to twenty percent extra bandwidth for roughly thirty to forty percent lower average delay and shorter worst-case delays in the project’s description. It is a pure algorithm: it does not send or receive UDP packets itself and expects the host application to provide output callbacks and even clock timing, with no system calls inside the core.
The implementation ships as two C source files that can be copied into an existing stack. Normal and fast modes adjust retransmission, selective resend, ACK behavior, and optional flow control. Operators configure nodelay, interval, resend thresholds, congestion behavior, windows, MTU, and minimum RTO through documented API calls.
KCP is positioned as a modular protocol unit that can be combined with encryption, FEC, or routing layers rather than as a monolithic networking stack. It has been used in games and large-scale networked products cited by the author, and can be installed via the vcpkg package manager.
Key features
- Selectable fast and normal modes
- Selective packet retransmission
- Fast retransmit on ACK gaps
- Configurable delayed ACK
- Combined ACK and UNA headers
- Optional reduced flow control
- Two-file C integration
- Callback-based UDP framing
Use cases
- UDP games and realtime sync
- Low-latency tunnels such as kcptun
- Custom P2P or ARQ stacks
- Mobile or Wi-Fi lossy links
- Embedding reliability in existing protocols