Example #1
0
        public BufferSocketRef(UDPSocketClient client)
        {
            Client = client;

             /// See if we are using our pinned-memory protection, if we are use from the pool, if not, just new it
             if (UDPSocketClient.m_BufferPool != null)
            bRecv = UDPSocketClient.m_BufferPool.Checkout();
             else
            bRecv = new byte[UDPSocketClient.m_nBufferSize];
        }
Example #2
0
        public BufferSocketRef(UDPSocketClient client)
        {
            Client = client;

            /// See if we are using our pinned-memory protection, if we are use from the pool, if not, just new it
            if (UDPSocketClient.m_BufferPool != null)
            {
                bRecv = UDPSocketClient.m_BufferPool.Checkout();
            }
            else
            {
                bRecv = new byte[UDPSocketClient.BufferSize];
            }
        }
Example #3
0
        public void Bind(IPEndPoint localEp)
        {
            if (IsBound == false)
            {
                LocalEndpoint = localEp;
                RTPUDPClient  = new SocketServer.UDPSocketClient(LocalEndpoint);
                RTPUDPClient.Bind();

#if !WINDOWS_PHONE
                LocalEndpoint = RTPUDPClient.s.LocalEndPoint as IPEndPoint;
#endif
                IsBound = true;
                RTPUDPClient.OnReceiveMessage += new SocketServer.UDPSocketClient.DelegateReceivePacket(RTPUDPClient_OnReceiveMessage);

                //I changed Bind this line should be uncommented
                //    RTPUDPClient.StartReceiving();
                //
            }
        }
Example #4
0
        public virtual void StopSending()
        {
            if (IsActive == false)
            {
                return;
            }

            IsActive = false;
            IsBound  = false;
            if (SendTimer != null)
            {
                SendTimer.Cancel();
                SendTimer = null;
            }
            if (ExpectPacketTimer != null)
            {
                ExpectPacketTimer.Cancel();
                ExpectPacketTimer = null;
            }
            RTPUDPClient.StopReceiving();
            RTPUDPClient.OnReceiveMessage -= new UDPSocketClient.DelegateReceivePacket(RTPUDPClient_OnReceiveMessage);
            RTPUDPClient = null;
        }