Esempio n. 1
0
        public TCPServerSender(InstructorModel instructor)
        {
            m_MaxConcurrentSends = MAX_CONCURRENT_SENDS;
            this.RestoreConfig();

            //Register for events to track current slide
            m_Instructor     = instructor;
            m_CurrentSlideID = GetSlideID(instructor); // Get initial slide if any
            m_Instructor.Changed["CurrentDeckTraversal"].Add(new PropertyEventHandler(OnCurrentDeckTraversalChanged));

            //Create the queue
            m_SendQueue = new TCPServerSendQueue();
            //Clients currently engaged in a send operation
            m_SendingParticipants = new Hashtable();
            //For synchronizing the closing of client sockets
            m_ClosingSockets = new Hashtable();
            //Current map of Client Guid to Socket
            m_SocketMap = new Hashtable();

            ///A thread to keep data flowing from the queue:
            Thread sendThread = new Thread(new ThreadStart(SendThread));

            sendThread.Name = "TCPServer Send Thread";
            sendThread.Start();
        }
        Hashtable m_SocketMap; //Key is Guid, value is Socket

        #endregion Fields

        #region Constructors

        public TCPServerSender(InstructorModel instructor)
        {
            m_MaxConcurrentSends = MAX_CONCURRENT_SENDS;
            this.RestoreConfig();

            //Register for events to track current slide
            m_Instructor = instructor;
            m_CurrentSlideID = GetSlideID(instructor); // Get initial slide if any
            m_Instructor.Changed["CurrentDeckTraversal"].Add(new PropertyEventHandler(OnCurrentDeckTraversalChanged));

            //Create the queue
            m_SendQueue = new TCPServerSendQueue();
            //Clients currently engaged in a send operation
            m_SendingParticipants = new Hashtable();
            //For synchronizing the closing of client sockets
            m_ClosingSockets = new Hashtable();
            //Current map of Client Guid to Socket
            m_SocketMap = new Hashtable();

            ///A thread to keep data flowing from the queue:
            Thread sendThread = new Thread(new ThreadStart(SendThread));
            sendThread.Name = "TCPServer Send Thread";
            sendThread.Start();
        }