提交 1e18b264 编写于 作者: S spritehu 提交者: tanghai

修复IOS真机运行KCP错误 (#99)

上级 942e4c92
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
......@@ -49,13 +49,10 @@ namespace ETModel
this.remoteEndPoint = remoteEndPoint;
this.socket = socket;
this.kcp = Kcp.KcpCreate(this.RemoteConn, new IntPtr(this.LocalConn));
Kcp.KcpSetoutput(
this.kcp,
(bytes, len, k, user) =>
{
KService.Output(bytes, len, user);
return len;
}
Kcp_output
);
Kcp.KcpNodelay(this.kcp, 1, 10, 1, 1);
Kcp.KcpWndsize(this.kcp, 256, 256);
......@@ -153,11 +150,7 @@ namespace ETModel
this.kcp = Kcp.KcpCreate(this.RemoteConn, new IntPtr(this.LocalConn));
Kcp.KcpSetoutput(
this.kcp,
(bytes, len, k, user) =>
{
KService.Output(bytes, len, user);
return len;
}
Kcp_output
);
Kcp.KcpNodelay(this.kcp, 1, 10, 1, 1);
Kcp.KcpWndsize(this.kcp, 256, 256);
......@@ -401,6 +394,13 @@ namespace ETModel
}
}
[AOT.MonoPInvokeCallback(typeof(kcp_output))]
public static int Kcp_output(IntPtr bytes, int len, IntPtr kcp, IntPtr user)
{
KService.Output(bytes, len, user);
return len;
}
private void KcpSend(byte[] buffers, int length)
{
if (this.IsDisposed)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册