Esempio n. 1
0
        public static void Stop()
        {
            listenerSocket.StopListening();

            AsynchronousSocket[] sockets = (AsynchronousSocket[])
                                           clients.ToArray(typeof(AsynchronousSocket));
            foreach (AsynchronousSocket socket in sockets)
            {
                socket.Disconnect();
            }
            clients.Clear();
        }
Esempio n. 2
0
        public void Stop()
        {
            // Give 30 seconds for clients to finish downloading
            int retriesRemaining = 60;

            while ((clients.Count > 0) && (retriesRemaining > 0))
            {
                Thread.Sleep(500);
                retriesRemaining--;
            }
            foreach (object sock in clients)
            {
                AsynchronousSocket socket = sock as AsynchronousSocket;
                socket.Disconnect();
            }
            clients.Clear();
            listenerSocket.StopListening();
        }