New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
请问ikcp_setoutput回调问题 #375
Comments
多线程操作同一个 kcp 对象? |
因为我设计接收是死循环,所以我在ikcp_setoutput()后面就启动线程接收,第一次用,不是很明白使用方法,请指教^_^!! |
我试了用ikcp_send()发送数据后直接调用接收函数(不是线程),ikcp_setoutput()回调函数输出也是提这个错,
|
纯算法,没有系统调用,你应该放在一个线程里调用,或者自己枷锁,否则出问题。 |
用python测试没问题 ret = find_library("kcp") load_clib("build/Release/kcp.dll")load_clib(ret) def test_out_puta(data, size): def test_out_putb(data, size): a = Ikcp(123, test_out_puta) a.setmtu(64)a.setmtu(64)a.nodelay(1, 20, 1, 1) while True:
可是我用的是易语言编程,流程完完全全按python来写(一个线程里跑),问题还是出在回调上(数据大小在MTU内,单包就没问题),回调4个参数都是用整数型(4字节对齐)
我怀疑是不是回调参数类型引来的。 |
你先自己改成单线程再说啊。不然看啥啊。 |
.版本 2 .子程序 out_puta, 整数型 调试输出 (“out_puta”, buf, len, ikcp, user) .子程序 out_putb, 整数型 调试输出 (“out_putb”, buf, len) .子程序 main a.create (123, 0) a.setoutput (到整数 (&out_puta)) a.nodelay (1, 20, 1, 1) ' a.setmtu (64) .判断循环首 (真) 我现在就是单线测试,跟python一样的流程 |
测试我用MTU = 128
发送数据大小 = 1400
用ikcp_send()发送后,ikcp_setoutput()回调输出:
调试输出 (“output”, ikcp, buf, len)
请问这是什么问题?
The text was updated successfully, but these errors were encountered: