コード例 #1
0
ファイル: SsdpServer.cs プロジェクト: northspb/p2pproxy
        public void Stop()
        {
            if (this.listenerThreads != null)
            {
                foreach (Timer timer in this.notifyTimers)
                    timer.Dispose();

                //Uzavre ListenerSocket a tym aj funkcia ListenNotify odosle spravu "byebye" a uzavre NotifySocket
                foreach (MySocket socket in this.sockets)
                    socket.ListenerSocket.Close();

                foreach (Thread thread in this.listenerThreads)
                    thread.Join();

                this.sockets = null;
                this.listenerThreads = null;
                this.notifyTimers = null;
            }
        }
コード例 #2
0
ファイル: SsdpServer.cs プロジェクト: northspb/p2pproxy
        public void Start()
        {
            if (listenerThreads == null)
            {

                sockets = GetSockets().ToArray();

                listenerThreads = new Thread[sockets.Length];
                notifyTimers = new Timer[sockets.Length];

                for (int i = 0; i < sockets.Length; i++)
                {
                    listenerThreads[i] = new Thread(ListenNotify);
                    listenerThreads[i].Start(sockets[i]);

                    notifyTimers[i] = new Timer(OnNotifyTimeout, sockets[i], 1000, upnpServer.RootDevice.MaxAge * 900);
                }
            }
        }
コード例 #3
0
ファイル: SsdpServer.cs プロジェクト: northspb/p2pproxy
        public void Start()
        {
            if (this.listenerThreads == null)
            {
                this.sockets = GetSockets().ToArray();

                this.listenerThreads = new Thread[this.sockets.Length];
                this.notifyTimers = new Timer[this.sockets.Length];

                for (int i = 0; i < this.sockets.Length; i++)
                {
                    this.listenerThreads[i] = new Thread(new ParameterizedThreadStart(ListenNotify));
                    this.listenerThreads[i].Start(this.sockets[i]);

                    //Oznamuje v pravidelnych intervaloch pritomnost, zaciatok je oneskoreny o sekundu
                    //Sprava sa posiela o nieco skor ako maxAge, preto nie je * 1000
                    this.notifyTimers[i] = new Timer(new TimerCallback(OnNotifyTimeout), this.sockets[i], 1000, this.maxAge * 900);
                }
            }
        }