networkextension / libkcp

FEC enhanced KCP session library for iOS/Android in C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libkcp

Powered Build Status

FEC enhanced KCP client session library for iOS/Android, compatible with kcp-go.

libkcp

Features

  1. Optimized for Online Games.
  2. Stream based interface, you can easily switch from your TCP based protocol to libkcp or dualstack.
  3. FEC(Forward Error Correction) Support with Reed-Solomon Codes
  4. Add iOS/macOs Framework and Test target
  5. MAS app https://itunes.apple.com/us/app/a-big-t/id1114040100?l=zh&ls=1&mt=12 support kcptun use this lib

Usage

libkcp has been designed as a Frame-Driven library, the main loop was supposed as:

GameInit()
NetworkInit()
While (!isGameOver) Do      // e.g:  A 30FPS Game
       LibKCP.Read()
       LibKCP.Write()
       LibKCP.Update()
       Game.Logic()
       Game.Render()
       Wait(33ms)   // clock
End

The Read/Write/Update functions of libkcp are guaranteed to be non-blocking.
Please read kcp_test.cpp fec_test.cpp for library usage.

Demo

start echo server(golang)

$go get github.com/xtaci/kcp-go
$go run kcpserver.go

compile and run libkcp(Best with CLion), and watch output.

Caveats

  1. Packet level encryption use CommonCrypto, dose not pass test,need test and debug

Troubleshooting

  1. C++11 is required for compiling.

About

FEC enhanced KCP session library for iOS/Android in C++

License:MIT License


Languages

Language:C 81.2%Language:C++ 12.7%Language:Objective-C++ 4.1%Language:Objective-C 1.7%Language:Go 0.2%Language:CMake 0.1%