The APTCP (Asynchronous Persistent TCP) protocol is a session-layer L5 specification designed to maintain continuous connections despite IP address changes or network interruptions. It operates as an abstraction layer over standard TCP, allowing applications to handle reconnections without modifying core logic.

The protocol uses a 5-byte header for frames and a 64-bit sequence ID to ensure packet ordering and deduplication. When a physical connection drops, the logical socket enters a waiting state, buffering outgoing data up to 5 MB while waiting for the link to recover.

Session restoration is handled via a three-step HMAC-SHA256 challenge-response handshake. This mechanism prevents session hijacking by requiring mutual authentication. The initial key exchange utilizes a 2048-bit Diffie-Hellman MODP group to establish a session key.

APTCP is implemented as a library for Go and Python. It is designed to be compatible with standard TCP infrastructure, including HTTP CONNECT proxies and SOCKS5, which often restrict UDP-based protocols like QUIC. The implementation supports optional TLS integration for enhanced security.

Performance tests on an Intel Core i5-12400F processor showed a throughput of 759 MB/s with TLS enabled and approximately 1.09 GB/s without TLS, using 32 KB chunks. The protocol overhead is 13 bytes per DATA frame and 13 bytes per ACK frame.