Example #1
0
        protected void Start(IPAddress mifaceIP)
        {
            ServicePointManager.ServerCertificateValidationCallback = (obj, certificate, chain, errors) => true;

            ProcessTuneSection process = ProcessTuneSection.GetSection();
            if (null != process && process.HighPriority)
            {
                Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
            }

            PrintConfiguration(mifaceIP);

            _listener = new TcpListener(_Address, _iPort);
            _listener.Start();
#if NET_45_OR_GREATER
            AcceptSocketAsync(_listener);
#else
            _listener.BeginAcceptSocket(OnAcceptNewClient, _listener);
#endif // NET_45_OR_GREATER

            Console.WriteLine("Listening, hit enter to stop");
            Console.WriteLine();

            CAWebClient.CAAuthData auth = CAWebClient.CAAuthData.GetSection();
            _moduleVLC = new LibVLCModule(
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                (null == auth) ? string.Format("http://localhost:{0}/ca/", _iPort) : auth.CaUri,
                mifaceIP
                );

            string strBestMac = _moduleVLC.GetBestMacAddress();
            if (strBestMac.Length > 0)
            {
                MacAddress = strBestMac;
            }

            if (null != process && process.UseAuxLowPriorityThreadPool)
            {
                _lowThreadPool = new LowPriorityThreadPool();
            }
        }