KCP is a fast and reliable ARQ protocol implemented in C that trades 10-20% bandwidth overhead for 30-40% lower average latency and three times lower maximum latency compared to TCP.
KCP solves the problem of high-latency packet transmission by optimizing for speed rather than bandwidth utilization. It uses several algorithmic strategies to achieve this: RTO multipliers of 1.5 instead of TCP's 2, selective retransmission of only lost packets rather than all subsequent data, fast retransmission triggered by duplicate acknowledgments without waiting for timeout, configurable ACK delay, and a hybrid acknowledgment model combining UNA and ACK information. The protocol is implemented as a pure algorithm with no system calls; it delegates all packet sending and receiving to the caller via callbacks and requires the caller to provide timing information externally. This design allows it to be integrated into existing UDP-based protocols or custom protocol stacks by copying two source files and writing minimal integration code.
KCP suits applications prioritizing low latency over maximum bandwidth utilization, particularly real-time communication, gaming, and P2P systems built on UDP. It offers both normal and fast modes, with the fast mode suitable for scenarios where timing guarantees matter more than fairness. The tool is available through standard package managers, making integration straightforward for projects already using UDP-based transport layers.
The project maintains two active versions: a stable v1 branch and a v2 branch that introduces pluggable flow control algorithms, allowing flow control strategy replacement without protocol changes. Development activity shows ongoing refinement of the core algorithm with attention to configuration flexibility and backward compatibility.