/// <summary>
        /// Accept socket callback.
        /// </summary>

        //void OnAccept (IAsyncResult result) { AddPlayer(mListener.EndAcceptSocket(result)); }

        /// <summary>
        /// Stop listening to incoming connections and disconnect all players.
        /// </summary>

        public void Stop()
        {
            if (lobbyLink != null)
            {
                lobbyLink.Stop();
            }

            mAllowUdp = false;

            // Stop the worker thread
            if (mThread != null)
            {
                mThread.Abort();
                mThread = null;
            }

            // Stop listening
            if (mListener != null)
            {
                mListener.Stop();
                mListener = null;
            }
            mUdp.Stop();

            // Remove all connected players and clear the list of channels
            for (int i = mPlayers.size; i > 0;)
            {
                RemovePlayer(mPlayers[--i]);
            }
            mChannels.Clear();
        }
Exemple #2
0
        /// <summary>
        /// Stop listening to incoming broadcasts.
        /// </summary>

        public void StopUDP()
        {
#if !UNITY_WEBPLAYER
            if (mUdp.isActive)
            {
                if (isConnected)
                {
                    BeginSend(Packet.RequestSetUDP).Write((ushort)0);
                    EndSend();
                }
                mUdp.Stop();
            }
#endif
        }
        /// <summary>
        /// Stop listening for incoming packets.
        /// </summary>

        public override void Stop()
        {
            if (mThread != null)
            {
                mThread.Abort();
                mThread = null;
            }

            if (mUdp != null)
            {
                mUdp.Stop();
                mUdp = null;
            }
            mList.Clear();
        }
Exemple #4
0
        /// <summary>
        /// Stop listening for incoming packets.
        /// </summary>

        public override void Stop()
        {
            if (mThread != null)
            {
                mThread.Interrupt();
                mThread.Join();
                mThread = null;
            }

            if (mUdp != null)
            {
                mUdp.Stop();
                mUdp = null;
            }
            mList.Clear();
        }
        /// <summary>
        /// Stop listening for incoming packets.
        /// </summary>

        public override void Stop()
        {
            if (mThread != null)
            {
                mThread.Interrupt();
                mThread.Join();
                mThread = null;
            }

            if (mUdp != null)
            {
                mUdp.Stop();
                mUdp = null;

                Tools.LoadList(banFilePath, mBan);
            }
            mList.Clear();
        }
        protected override void OnDisable()
        {
            isActive = false;
            base.OnDisable();

            try
            {
                mUdp.Stop();

                if (mRequest != null)
                {
                    mRequest.Recycle();
                    mRequest = null;
                }
                if (onChange != null)
                {
                    onChange();
                }
            }
            catch (System.Exception) { }
        }