Skip to content

purpleroc/KCP_over_UDP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KCP_over_UDP

Demo for kcp over udp. 用于学习理解KCP协议,提供libevwhile循环处理两种思路。

Complie

Client

While 循环处理

gcc -g client.cpp ikcp.c -o client

Libev 处理

libev 源码:https://github.com/enki/libev 先编译按装libev:

# 编译和使用方法可参考:https://zhuanlan.zhihu.com/p/626826013

git clone https://github.com/enki/libev
cd libev
./configure # 可指定位置
make
make install
# 编译好后,libev被放在了/usr/local/lib这个文件夹里。
# 设置系统 动态库 链接路径
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig

之后执行: gcc -g client_libev.cpp ikcp.c -lev -o client_libev

Server

go mod init
go mod tidy
# 之后
go run server.go

# 或者
go build -o server server.go
./server

Doc

https://mp.weixin.qq.com/s/8dn4eZptGeTipOFDyYInFA

About

Demo for kcp over udp.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published