示例#1
0
文件: KCPNative.cs 项目: niuniuzhu/RC
 public void Dispose()
 {
     this._output   = null;
     this._writelog = null;
     NATIVE_TO_KCP.Remove(this._ikcpcb);
     KCPInterface.ikcp_release(this._ikcpcb);
 }
示例#2
0
文件: KCPNative.cs 项目: niuniuzhu/RC
        public KCPNative(uint conv, uint user, KCP.OutputHandler output, KCP.LoggerHandler writelog)
        {
            int    size   = Marshal.SizeOf(user);
            IntPtr intPtr = Marshal.AllocHGlobal(size);

            Marshal.StructureToPtr(user, intPtr, false);
            this._ikcpcb = KCPInterface.ikcp_create(conv, intPtr);
            Marshal.FreeHGlobal(intPtr);
            NATIVE_TO_KCP[this._ikcpcb] = this;
            this._output   = output;
            this._writelog = writelog;
            IntPtr outputPtr = Marshal.GetFunctionPointerForDelegate(OUTPUT_DELEGATE);

            KCPInterface.ikcp_setoutput(this._ikcpcb, outputPtr);
            IntPtr logPtr = Marshal.GetFunctionPointerForDelegate(LOG_DELEGATE);

            KCPInterface.ikcp_setlog(this._ikcpcb, logPtr);
        }
示例#3
0
文件: KCPNative.cs 项目: niuniuzhu/RC
        public int Send(byte[] buffer, int offset, int size)
        {
            int result = KCPInterface.ikcp_send(this._ikcpcb, ref buffer[offset], size);

            return(result);
        }
示例#4
0
文件: KCPNative.cs 项目: niuniuzhu/RC
        public int Recv(byte[] buffer, int size)
        {
            int result = KCPInterface.ikcp_recv(this._ikcpcb, ref buffer[0], size);

            return(result);
        }
示例#5
0
文件: KCPNative.cs 项目: niuniuzhu/RC
 public int PeekSize()
 {
     return(KCPInterface.ikcp_peeksize(this._ikcpcb));
 }
示例#6
0
文件: KCPNative.cs 项目: niuniuzhu/RC
 public void SetLogMask(int mask)
 {
     KCPInterface.ikcp_setlogmask(this._ikcpcb, mask);
 }
示例#7
0
文件: KCPNative.cs 项目: niuniuzhu/RC
 public void Clear()
 {
     KCPInterface.ikcp_clear(this._ikcpcb);
 }
示例#8
0
文件: KCPNative.cs 项目: niuniuzhu/RC
 public int WaitSnd()
 {
     return(KCPInterface.ikcp_waitsnd(this._ikcpcb));
 }
示例#9
0
文件: KCPNative.cs 项目: niuniuzhu/RC
 public int WndSize(int sndwnd, int rcvwnd)
 {
     return(KCPInterface.ikcp_wndsize(this._ikcpcb, sndwnd, rcvwnd));
 }
示例#10
0
文件: KCPNative.cs 项目: niuniuzhu/RC
 public int Interval(int interval)
 {
     return(KCPInterface.ikcp_interval(this._ikcpcb, interval));
 }
示例#11
0
文件: KCPNative.cs 项目: niuniuzhu/RC
 public int NoDelay(int nodelay, int interval, int resend, int nc)
 {
     return(KCPInterface.ikcp_nodelay(this._ikcpcb, nodelay, interval, resend, nc));
 }
示例#12
0
文件: KCPNative.cs 项目: niuniuzhu/RC
 public int SetMtu(int mtu)
 {
     return(KCPInterface.ikcp_setmtu(this._ikcpcb, mtu));
 }
示例#13
0
文件: KCPNative.cs 项目: niuniuzhu/RC
 public uint Check(uint current)
 {
     return(KCPInterface.ikcp_check(this._ikcpcb, current));
 }
示例#14
0
文件: KCPNative.cs 项目: niuniuzhu/RC
 public void Update(uint current)
 {
     KCPInterface.ikcp_update(this._ikcpcb, current);
 }
示例#15
0
文件: KCPNative.cs 项目: niuniuzhu/RC
        public int Input(byte[] data, int offset, int size)
        {
            int result = KCPInterface.ikcp_input(this._ikcpcb, ref data[offset], size);

            return(result);
        }