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

            return(result);
        }
Esempio n. 4
0
        public int Recv(byte[] buffer, int size)
        {
            int result = KCPInterface.ikcp_recv(this._ikcpcb, ref buffer[0], size);

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

            return(result);
        }