Lua binding for KCP, interface description written in lua-interface.md, see details of the project description within the KCP. what is KCP? please visit: https://github.com/skywind3000/kcp, http://www.skywind.me/blog/archives/1048
#Make: Just make
#Structure: ####3rd: lua: taken lua53 kcp: visit https://github.com/skywind3000/kcp
####src: lkcp.c: the file for bind kcp testkcp.lua: the file for test kcp
####run_test.sh: After the project compile successfully, you can run this file to test kcp
#lua-interface:
Init KCP layer.
output: a callback for KCP layer to invoke when send data to transport layer
[
output prototype:
function output(info, buf)
...
end
info is brought when invoke lkcp_create
buf is to be sent
]
ret: always 0
Create kcp object.
session: number mark session
info: extra info, when KCP layer invoke callback to send data, KCP layer would brings that to output
[
info prototype:
info = {1, "who", ...}
notice:
the form of info must be sequential, and elements must be string or integer
]
kcp: kcp object
Set maximum window size: sndwnd=32, rcvwnd=32 by default
sndwnd: send window size
rcvwnd: recive window size
None
Config re-transmission and flow control
nodelay: 0:disable(default), 1:enable
interval: internal update timer interval in millisec, default is 100ms
resend: 0:disable fast resend(default), 1:enable fast resend
nc: 0:normal congestion control(default), 1:disable congestion control
ret: always 0
Get when to invoke lkcp_update
current: current timestamp in millisec
when: timestamp in millisec when to invoke lkcp_update
Update state (call it repeatedly, every 10ms-100ms), or you can ask
current: current timestamp in millisec
None
User/upper level send
data: data to be sent
sent_len: below zero for error, otherwise succeed
Flush pending data
None
None
When you received a low level packet (eg. UDP packet), call it
data: data received from transport layer
ret: below zero for error, otherwise succeed
User/upper level recv
None
rcv_len: Less than or equal to 0 for EAGAIN, otherwise for rcv_len
rcv_buf: if rcv_len greater than 0, rcv_buf is data to recv