QtKcp
is a Kcp packaging library based on Qt, and the underlying layer uses UDP transmission.
It simplifies the use of Kcp.
Kcp
address: https://github.com/skywind3000/kcp
Clone repository
git clone https://github.com/mengps/QtKcp && cd QtKcp
git submodule update --init
cmake
build:
mkdir build && cd build
cmake ..
cmake -- build .
cmake -- install
qmake
build:
Using QtKcp.pro
Server side:
QKcpServer server;
server.listen(QHostAddress::Any, 12345 );
Client:
QKcpSocket client;
client-> connectToHost (QHostAddress( " 127.0.0.1 " ), 12345);
Its behavior and interface are basically consistent with QTcpServer/QTcpSocket.
It is of course far from complete and will be added as needed.
In order to complete the UDP -> TCP-like transition, the implementation is slightly weird: the port of the connection will change when the connection is successful.
This is because the host (Server) is only responsible for listening for connections, and the real connection will use the new port.
Use MIT LICENSE
Windows 11, Qt 5.15.2/Qt 6.7.3