Пример #1
0
        public void StopListener(string ListenerId)
        {
            var tcpListener = TCPListeners.Where(l => l.ListenerId.Equals(ListenerId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();

            if (tcpListener != null)
            {
                TCPListeners.Remove(tcpListener);
            }
            else
            {
                var httpModule = HTTPListeners.Where(l => l.Listener.ListenerId.Equals(ListenerId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
                if (httpModule != null)
                {
                    httpModule.Stop();
                    HTTPListeners.Remove(httpModule);
                }
            }
        }
Пример #2
0
        public void StartHttpListener(NewHttpListenerRequest request)
        {
            var listener = new ListenerHttp
            {
                BindPort       = request.BindPort,
                ConnectAddress = request.ConnectAddress,
                ConnectPort    = request.ConnectPort
            };

            var module = new HTTPCommModule
            {
                Listener = listener
            };

            HTTPListeners.Add(module);
            module.Init();
            module.Start();
        }