[TOC]
-
The
kcp-perl
is a object-oriented perl module for extending skywind3000/kcp -
This project has some advantages:
- friendly:
- Perl-like style
- object-orirented
- reliable: matched test scripts of the project
- real-time:construting project based on the latest KCP source code
- conveniently:you can get the release version by using
cpan
- friendly:
kcp-perl
├── build.sh # building tool
├── Changes
├── .devcontainer # VSCode Configure of extension 'Dev Containers'
├── Dockerfile.dev # config of container for developing
├── .gitignore
├── .gitmodules
├── KCP # perl extension of KCP
│ ├── Changes
│ ├── KCP.xs # code of the extension
│ ├── lib
│ │ ├── KCP
│ │ │ └── Test.pm
│ │ └── KCP.pm
│ ├── Makefile.PL
│ ├── MANIFEST
│ ├── ppport.h
│ ├── README
│ ├── t # test scripts
│ └── typemap
├── kcp-src # associate to "skywind3000/kcp" project
├── LICENSE
├── README.md
- install
kcp-perl
release withcpan
:-
install latest version:
cpan -i KCP
-
install special version:
cpan -i HOMQYY/KCP-0.04.tar.gz
-
The project is depend on some "system tools" and "perl modules"
-
cpan
yum install -y cpan
-
perl-Test-Simple(required by test)
yum install -y perl-Test-Simple
-
Devel::PPPort
cpan -i Devel::PPPort
-
Test::More(required by test)
cpan -i Test::More
If you are getting the project at first time, you should execute the following command to get code of kcp
git submodule init
git submodule update
Next, to start building
./build.sh
-
Configure
./build.sh configure
-
Compile
./build.sh compile
-
Test
./build.sh test
-
Install
./build.sh install
-
You can get "Guide Manual" by using following commands in Shell after installing:
man KCP
perldoc KCP
- or view the guide manual online: KCP Guide manual
-
After installing, you can use it, for example:
use KCP; sub output { my ($data, $user) = @_; $user->{socket}->send($data, 0); } ... my $kcp = KCP::new($conv, $user); $kcp->set_mode("fast")->set_output(\&output); ... # scheduled call $kcp->update($current_millisec); ... # to send $data $kcp->send($data); ... # to recv data $kcp->recv($data, 65536); # input data of transport $socket->recv($data, 65536, 0); $kcp->input($data); ...