Пример #1
0
        public TCPServer(IPEndPoint localEP, PresenterModel model, ClassroomModel classroom,
                         InstructorModel instructor)
        {
            string portStr = System.Configuration.ConfigurationManager.AppSettings[this.GetType().ToString() + ".TCPListenPort"];
            int    p;

            if (Int32.TryParse(portStr, out p))
            {
                TCPListenPort = p;
            }
            RestoreConfig();
            m_ClientConnected = new ManualResetEvent(false);
            m_Participant     = model.Participant;
            m_Classroom       = classroom;
            m_ClientCount     = 0;
            this.m_Network    = model.Network;
            m_NetworkStatus   = new NetworkStatus(ConnectionStatus.Disconnected, ConnectionProtocolType.TCP, TCPRole.Server, 0);
            this.m_Network.RegisterNetworkStatusProvider(this, true, m_NetworkStatus);

            if (localEP != null)
            {
                this.m_ListenEP = localEP;
            }
            else
            {
                IPAddress ip = IPAddress.Any;
                //Use IPv4 unless it is unavailable.  TODO: Maybe this should be a configurable parameter?
                if ((!Socket.OSSupportsIPv4) && (Socket.OSSupportsIPv6))
                {
                    ip = IPAddress.IPv6Any;
                }
                this.m_ListenEP = new IPEndPoint(ip, TCPListenPort);
            }

            m_AllClients   = new Hashtable();
            m_ReceiveQueue = new Queue();

            this.m_Encoder      = new Chunk.ChunkEncoder();
            this.m_ServerSender = new TCPServerSender(instructor);

            //Start bridging if config file says so
#if RTP_BUILD
            m_U2MBridge = null;
            string enableBridge = System.Configuration.ConfigurationManager.AppSettings[this.GetType().ToString() + ".EnableBridge"];
            if (enableBridge != null)
            {
                bool enable = false;
                if (bool.TryParse(enableBridge, out enable) && enable)
                {
                    Trace.WriteLine("Unicast to Multicast Bridge enabled.", this.GetType().ToString());
                    m_U2MBridge = new UnicastToMulticastBridge(model);
                }
            }
#endif
        }
Пример #2
0
        public TCPServer(IPEndPoint localEP, PresenterModel model, ClassroomModel classroom,
            InstructorModel instructor)
        {
            RestoreConfig();
            m_ClientConnected = new ManualResetEvent(false);
            m_Participant = model.Participant;
            m_Classroom = classroom;
            m_ClientCount = 0;
            this.m_Network = model.Network;
            m_NetworkStatus = new NetworkStatus(ConnectionStatus.Disconnected, ConnectionProtocolType.TCP, TCPRole.Server, 0);
            this.m_Network.RegisterNetworkStatusProvider(this, true, m_NetworkStatus);

            if (localEP != null) {
                this.m_ListenEP = localEP;
            }
            else {
                this.m_ListenEP = new IPEndPoint(IPAddress.Any, DefaultPort);
            }

            m_AllClients = new Hashtable();
            m_ReceiveQueue = new Queue();

            this.m_Encoder = new Chunk.ChunkEncoder();
            this.m_ServerSender = new TCPServerSender(instructor);

            //Start bridging if config file says so
            #if RTP_BUILD
            m_U2MBridge = null;
            string enableBridge = System.Configuration.ConfigurationManager.AppSettings[this.GetType().ToString() + ".EnableBridge"];
            if (enableBridge != null) {
                bool enable = false;
                if (bool.TryParse(enableBridge, out enable) && enable) {
                    Trace.WriteLine("Unicast to Multicast Bridge enabled.", this.GetType().ToString());
                    m_U2MBridge = new UnicastToMulticastBridge(model);
                }
            }
            #endif
        }
Пример #3
0
        public TCPServer(IPEndPoint localEP, PresenterModel model, ClassroomModel classroom,
            InstructorModel instructor)
        {
            string portStr = System.Configuration.ConfigurationManager.AppSettings[this.GetType().ToString() + ".TCPListenPort"];
            int p;
            if (Int32.TryParse(portStr, out p)) {
                TCPListenPort = p;
            }
            RestoreConfig();
            m_ClientConnected = new ManualResetEvent(false);
            m_Participant = model.Participant;
            m_Classroom = classroom;
            m_ClientCount = 0;
            this.m_Network = model.Network;
            m_NetworkStatus = new NetworkStatus(ConnectionStatus.Disconnected, ConnectionProtocolType.TCP, TCPRole.Server, 0);
            this.m_Network.RegisterNetworkStatusProvider(this, true, m_NetworkStatus);

            if (localEP != null) {
                this.m_ListenEP = localEP;
            }
            else {
                IPAddress ip = IPAddress.Any;
                //Use IPv4 unless it is unavailable.  TODO: Maybe this should be a configurable parameter?
                if ((!Socket.OSSupportsIPv4) && (Socket.OSSupportsIPv6)) {
                    ip = IPAddress.IPv6Any;
                }
                this.m_ListenEP = new IPEndPoint(ip, TCPListenPort);
            }

            m_AllClients = new Hashtable();
            m_ReceiveQueue = new Queue();

            this.m_Encoder = new Chunk.ChunkEncoder();
            this.m_ServerSender = new TCPServerSender(instructor);

            //Start bridging if config file says so
            #if RTP_BUILD
            m_U2MBridge = null;
            string enableBridge = System.Configuration.ConfigurationManager.AppSettings[this.GetType().ToString() + ".EnableBridge"];
            if (enableBridge != null) {
                bool enable = false;
                if (bool.TryParse(enableBridge, out enable) && enable) {
                    Trace.WriteLine("Unicast to Multicast Bridge enabled.", this.GetType().ToString());
                    m_U2MBridge = new UnicastToMulticastBridge(model);
                }
            }
            #endif
        }