Пример #1
0
 public void Dispose()
 {
     this._output   = null;
     this._writelog = null;
     NATIVE_TO_KCP.Remove(this._ikcpcb);
     KCPInterface.ikcp_release(this._ikcpcb);
 }
Пример #2
0
        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
        public int Send(byte[] buffer, int offset, int size)
        {
            int result = KCPInterface.ikcp_send(this._ikcpcb, ref buffer[offset], size);

            return(result);
        }
Пример #4
0
        public int Recv(byte[] buffer, int size)
        {
            int result = KCPInterface.ikcp_recv(this._ikcpcb, ref buffer[0], size);

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

            return(result);
        }