示例#1
0
        public void DequeueWorker()
        {
            while (KeepAlive)
            {
                IQueueItem item;
                try
                {
                    foreach (var entry in MQ)
                    {
                        var q = entry.Value;

                        if (q.TryDequeue(out item))
                        {
                            EventQueue.Enqueue(item);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Netlog.Exception("Topic Dequeue Worker error ", ex);
                }

                Thread.Sleep(DequeueInterval);
            }
            Netlog.Warn("Topic Dequeue Worker stoped!");
        }
示例#2
0
        protected virtual void OnSyncTask()
        {
            try
            {
                //this.LogAction(CacheAction.SyncTime, CacheActionState.Debug, "SyncTaskBox OnSyncTask... ");

                //0 indicates that the method is not in use.
                if (0 == Interlocked.Exchange(ref synchronized, 1))
                {
                    ISyncTask syncTask = null;
                    if (m_SynBox.TryDequeue(out syncTask))
                    {
                        //RenderTask(syncTask);

                        syncTask.DoSync();



                        //this.LogAction(CacheAction.SyncTime, CacheActionState.Debug, "SyncTaskBox OnSyncTask RenderTask Start {0}", syncTask.ItemName);

                        //Task task = Task.Factory.StartNew(() => syncTask.DoSynchronize());
                    }
                }
            }
            catch (Exception ex)
            {
                Netlog.Exception("SyncTaskBox OnSyncTask End error :", ex);
            }
            finally
            {
                //Release the lock
                Interlocked.Exchange(ref synchronized, 0);
            }
        }
示例#3
0
        private void InternalStart()
        {
            try
            {
                Netlog.Debug(serviceName + " start...");

                m_ServerEnqueue = new ServerEnqueue();
                m_ServerEnqueue.Start(false);

                m_ServerDequeue = new ServerDequeue();
                m_ServerDequeue.Start(false);

                AgentManager.Start();

                if (QueueSettings.EnableQueueManager)
                {
                    m_ServerQueueManager = new ServerQueueManager();
                    m_ServerQueueManager.Start(false);
                }
                if (QueueSettings.EnableMailerQueue)
                {
                    MailerStart();
                }
                //svr.Start();//McLock.Lock.ValidateLock(), true);
                //host_serviceStart();
                Netlog.Debug(serviceName + " started!");
            }
            catch (Exception ex)
            {
                Netlog.Exception(serviceName + " InternalStart error ", ex, true, true);

                //File.AppendAllText(@"D:\Nistec\Services\MQueue.Agent\error.log", "error: " + ex.Message);
            }
        }
示例#4
0
        /// <summary>
        /// Dequeue Message
        /// </summary>
        /// <returns></returns>
        public virtual Ptr Dequeue()
        {
            Ptr ptr = Ptr.Empty;

            try
            {
                using (TransactionScope tran = new TransactionScope())
                {
                    if (highQ.TryDequeue(out ptr))
                    {
                        return(ptr);
                    }
                    else if (mediumQ.TryDequeue(out ptr))
                    {
                        return(ptr);
                    }
                    else if (normalQ.TryDequeue(out ptr))
                    {
                        return(ptr);
                    }
                    else
                    {
                        return(ptr);
                    }
                }
            }
            catch (Exception ex)
            {
                Netlog.Exception("PriorityQueue Dequeue error ", ex);
            }

            return(ptr);
        }
示例#5
0
 public void SendSubscriber(TopicSubscriber subscriber, QueueItem item)
 {
     try
     {
         var api = QueueApi.Get(subscriber.Protocol);
         //var message = item.ToMessage();// Message.Create(item.GetItemStream());
         api.Send(item);
     }
     catch (Exception ex)
     {
         Netlog.Exception("Topic Sender Subscriber error ", ex);
     }
 }
示例#6
0
        public override void Stop()
        {
            KeepAlive = false;

            try
            {
                for (int i = 0; i < MaxThreads; i++)
                {
                    thDequeueWorker[i].Join();
                    thSenderWorker[i].Join();
                }
            }
            catch (Exception ex)
            {
                Netlog.Exception("Topic Stop error ", ex);
            }
        }
示例#7
0
        /// <summary>
        /// Dequeue Message
        /// </summary>
        /// <returns></returns>
        public virtual Ptr Dequeue(Priority priority)
        {
            Ptr ptr = Ptr.Empty;

            try
            {
                using (TransactionScope tran = new TransactionScope())
                {
                    switch (priority)
                    {
                    case Priority.Normal:
                        if (normalQ.TryDequeue(out ptr))
                        {
                            return(ptr);
                        }
                        break;

                    case Priority.Medium:
                        if (mediumQ.TryDequeue(out ptr))
                        {
                            return(ptr);
                        }
                        break;

                    case Priority.High:
                        if (highQ.TryDequeue(out ptr))
                        {
                            return(ptr);
                        }
                        break;
                    }

                    return(ptr);
                }
            }
            catch (Exception ex)
            {
                Netlog.Exception("PriorityQueue Dequeue error ", ex);
            }

            return(ptr);
        }
示例#8
0
 public void SenderWorker()
 {
     while (KeepAlive)
     {
         IQueueItem item;
         try
         {
             if (EventQueue.TryDequeue(out item))
             {
                 Send(item.Host, item as QueueItem);
             }
         }
         catch (Exception ex)
         {
             Netlog.Exception("Topic Sender Worker error ", ex);
         }
         Thread.Sleep(SenderInterval);
     }
     Netlog.Warn("Topic Sender Worker stoped!");
 }
示例#9
0
        static void Main(string[] args)
        {
            try
            {
                if (args.Length > 0)
                {
                    //Install service
                    if (args[0].Trim().ToLower() == "/i")
                    {
                        System.Configuration.Install.ManagedInstallerClass.InstallHelper(new string[] { "/i", Assembly.GetExecutingAssembly().Location });
                    }

                    //Uninstall service
                    else if (args[0].Trim().ToLower() == "/u")
                    {
                        System.Configuration.Install.ManagedInstallerClass.InstallHelper(new string[] { "/u", Assembly.GetExecutingAssembly().Location });
                    }
                    //run as console application
                    else if (args[0].Trim().ToLower() == "/c")
                    {
                        ServiceManager SVC = new ServiceManager();
                        SVC.Start();
                        Console.WriteLine("Server Started as console");
                        Console.ReadKey();
                    }
                }
                else
                {
                    Console.WriteLine("Server Started...");

                    System.ServiceProcess.ServiceBase[] ServicesToRun;
                    ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service1() };
                    System.ServiceProcess.ServiceBase.Run(ServicesToRun);
                }
            }
            catch (Exception ex)
            {
                Netlog.Exception(Settings.ServiceName, ex, true, true);
            }
        }
示例#10
0
        /*
         * /// <summary>
         * /// Use the pipe classes in the System.IO.Pipes namespace to create the
         * /// named pipe. This solution is recommended.
         * /// </summary>
         * private void RunAsync()
         * {
         *  NamedPipeServerStream pipeServerAsync = null;
         *  bool connected = false;
         *  //const string ResponseMessage = "Default response from server\0";
         *  Console.WriteLine("{0} Pipe server async start listen Thread<{1}>", PipeName, Thread.CurrentThread.ManagedThreadId);
         *
         *  while (Listen)
         *  {
         *
         *
         *      try
         *      {
         *          // Prepare the security attributes (the pipeSecurity parameter in
         *          // the constructor of NamedPipeServerStream) for the pipe.
         *          PipeSecurity pipeSecurity = null;
         *          pipeSecurity = CreateSystemIOPipeSecurity();
         *
         *
         *          // Create the named pipe.
         *          pipeServerAsync = new NamedPipeServerStream(
         *              PipeName,                       // The unique pipe name.
         *              PipeDirection,            // The pipe is duplex
         *              NamedPipeServerStream.MaxAllowedServerInstances,
         *              PipeTransmissionMode.Message,   // Message-based communication
         *              PipeOptions,               // No additional parameters
         *              InBufferSize,                   // Input buffer size
         *              OutBufferSize,                  // Output buffer size
         *              pipeSecurity,                   // Pipe security attributes
         *              HandleInheritability.None       // Not inheritable
         *              );
         *
         *          //Netlog.InfoFormat("The named pipe ({0}) is created.", FullPipeName);
         *
         *          // Wait for the client to connect.
         *          //Netlog.Info("Waiting for the client's connection...");
         *          AsyncCallback myCallback = new AsyncCallback(WaitForConnectionAsyncCallback);
         *          IAsyncResult asyncResult = pipeServerAsync.BeginWaitForConnection(myCallback, pipeServerAsync);
         *
         *          while (!asyncResult.IsCompleted)
         *          {
         *              Thread.Sleep(100);
         *          }
         *
         *          connected = true;
         *          //Netlog.Info("Client is connected.");
         *
         *          //pipeServer.Flush();
         *
         *          // Flush the pipe to allow the client to read the pipe's contents
         *          // before disconnecting. Then disconnect the client's connection.
         *          pipeServerAsync.WaitForPipeDrain();
         *          pipeServerAsync.Disconnect();
         *          connected = false;
         *      }
         *      catch (Exception ex)
         *      {
         *          Netlog.Exception("The server throws the error: ", ex, ex.InnerException);
         *      }
         *      finally
         *      {
         *          if (pipeServerAsync != null)
         *          {
         *              if (connected && pipeServerAsync.IsConnected)
         *              {
         *                  pipeServerAsync.Disconnect();
         *              }
         *              pipeServerAsync.Close();
         *              pipeServerAsync = null;
         *          }
         *      }
         *  }
         *  Console.WriteLine("{0} Pipe server async stop listen Thread<{1}>", PipeName, Thread.CurrentThread.ManagedThreadId);
         * }
         */

        private void WaitForConnectionAsyncCallback(IAsyncResult result)
        {
            Message message = null;

            try
            {
                NamedPipeServerStream pipeServerAsync = (NamedPipeServerStream)result.AsyncState;

                pipeServerAsync.EndWaitForConnection(result);

                //message = QueueItem.ReadServerRquest(pipeServerAsync, InBufferSize);

                //message=ReadRequest(pipeServerAsync);

                //NetStream res = ExecRequset(message);

                //WriteResponse(pipeServerAsync, res);

                Execute(pipeServerAsync);
            }
            catch (OperationCanceledException oex)
            {
                Netlog.Exception("Pipe server error, The pipe was canceled: ", oex);
            }
            catch (Exception ex)
            {
                Netlog.Exception("Pipe server error: ", ex, true);
            }
            finally
            {
                if (message != null)
                {
                    ((IDisposable)message).Dispose();
                    message = null;
                }
            }
        }
示例#11
0
        //[PermissionSet(SecurityAction.Assert, Unrestricted = true)]
        private void InternalStart()
        {
            try
            {
                //System.Security.SecurityRules(RuleSet=System.Security.SecurityRuleSet.Level2)

                //using (FileStream fs = new FileStream(@"D:\Nistec\Services\Logs\qlog.log", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))
                //{
                //    StreamWriter w = new StreamWriter(fs);     // create a Char writer
                //    w.BaseStream.Seek(0, SeekOrigin.End);      // set the file pointer to the end
                //    w.Write("log test" + "\r\n");
                //    w.Flush();  // update underlying file
                //}


                Netlog.Debug(serviceName + " start...");

                //m_enableQueueController = AgentManager.Settings.EnableQueueController;
                //m_enableTopicController = AgentManager.Settings.EnableTopicController;

                AgentManager.Start();// m_enableQueueController, m_enableTopicController);

                if (AgentManager.Settings.EnablePipeProducer)
                {
                    m_PipeServerProducer = new PipeServerChannel(QueueChannel.Producer, QueueSettings.DefaultQueueProducer);
                    m_PipeServerProducer.Start();
                    //QLogger.Info("PipeServerChannel started...");
                }


                if (AgentManager.Settings.EnablePipeConsumer)
                {
                    m_PipeServerConsumer = new PipeServerChannel(QueueChannel.Consumer, QueueSettings.DefaultQueueConsumer);
                    m_PipeServerConsumer.Start();
                    //QLogger.Info("PipeServerListener started...");
                }


                //m_ServerDequeue = new PipeServerDequeue();
                //m_ServerDequeue.Start(false);


                if (AgentManager.Settings.EnableTcpProducer)
                {
                    m_TcpServerProducer = new TcpServerChannel(QueueChannel.Producer, QueueSettings.DefaultQueueProducer);
                    m_TcpServerProducer.Start();
                    //QLogger.Info("TcpServerChannel started...");
                }
                if (AgentManager.Settings.EnableTcpConsumer)
                {
                    m_TcpServerConsumer = new TcpServerChannel(QueueChannel.Consumer, QueueSettings.DefaultQueueConsumer);
                    m_TcpServerConsumer.Start();
                    //QLogger.Info("TcpServerListener started...");
                }
                if (AgentManager.Settings.EnableHttpProducer)
                {
                    m_HttpServerProducer = new HttpServerChannel(QueueChannel.Producer, QueueSettings.DefaultQueueProducer);
                    m_HttpServerProducer.Start();
                    //QLogger.Info("HttpServerChannel started...");
                }
                if (AgentManager.Settings.EnableHttpConsumer)
                {
                    m_HttpServerConsumer = new HttpServerChannel(QueueChannel.Consumer, QueueSettings.DefaultQueueConsumer);
                    m_HttpServerConsumer.Start();
                    //QLogger.Info("HttpServerListener started...");
                }

                if (AgentManager.Settings.EnableQueueManager)
                {
                    m_ServerQueueManager         = new PipeServerChannel(QueueChannel.Manager, QueueSettings.DefaultQueueManager);
                    m_ServerQueueManager.IsAsync = false;
                    m_ServerQueueManager.Start();// (false);
                    //QLogger.Info("ServerQueueManager started...");
                }

                //if (AgentManager.Settings.EnableFolderListener)
                //{
                //    m_FolderServer = new FolderServerListener();
                //    m_FolderServer.Start();
                //}
                //if (AgentManager.Settings.EnableDbListener)
                //{
                //    m_DbServer = new DbServerListener();
                //    m_DbServer.Start();
                //}


                //svr.Start();//McLock.Lock.ValidateLock(), true);
                //host_serviceStart();
                Netlog.Debug(serviceName + " started!");
            }
            catch (Exception ex)
            {
                Netlog.Exception(serviceName + " InternalStart error ", ex, true, true);

                //File.AppendAllText(@"D:\Nistec\Services\MQueue.Agent\error.log", "error: " + ex.Message);
            }
        }
示例#12
0
        private void Exec(bool isAsync)
        {
            NamedPipeServerStream pipeServer = null;
            Message message   = null;
            bool    connected = false;

            try
            {
                // Prepare the security attributes (the pipeSecurity parameter in
                // the constructor of NamedPipeServerStream) for the pipe.
                PipeSecurity pipeSecurity = null;
                pipeSecurity = CreateSystemIOPipeSecurity();


                // Create the named pipe.
                pipeServer = new NamedPipeServerStream(
                    PipeName,                     // The unique pipe name.
                    PipeDirection,                // The pipe is duplex
                    NamedPipeServerStream.MaxAllowedServerInstances,
                    PipeTransmissionMode.Message, // Message-based communication
                    PipeOptions,                  // No additional parameters
                    InBufferSize,                 // Input buffer size
                    OutBufferSize,                // Output buffer size
                    pipeSecurity,                 // Pipe security attributes
                    HandleInheritability.None     // Not inheritable
                    );

                if (isAsync)
                {
                    AsyncCallback myCallback  = new AsyncCallback(WaitForConnectionAsyncCallback);
                    IAsyncResult  asyncResult = pipeServer.BeginWaitForConnection(myCallback, pipeServer);

                    while (!asyncResult.IsCompleted)
                    {
                        Thread.Sleep(100);
                    }

                    connected = true;
                }
                else
                {
                    //Netlog.InfoFormat("The named pipe ({0}) is created.", FullPipeName);

                    // Wait for the client to connect.
                    //Netlog.Info("Waiting for the client's connection...");
                    pipeServer.WaitForConnection();
                    connected = true;
                    //Netlog.Info("Client is connected.");

                    //message = QueueItem.ReadServerRquest(pipeServer, InBufferSize);

                    //message = ReadRequest(pipeServer);

                    //NetStream res = ExecRequset(message);

                    //WriteResponse(pipeServer, res);

                    Execute(pipeServer);

                    //pipeServer.Flush();
                }
                // Flush the pipe to allow the client to read the pipe's contents
                // before disconnecting. Then disconnect the client's connection.
                pipeServer.WaitForPipeDrain();
                pipeServer.Disconnect();
                connected = false;
            }
            catch (Exception ex)
            {
                Netlog.Exception("The server throws the error: ", ex, true, true);
            }
            finally
            {
                if (pipeServer != null)
                {
                    if (connected && pipeServer.IsConnected)
                    {
                        pipeServer.Disconnect();
                    }
                    pipeServer.Close();
                    pipeServer = null;
                }
                if (message != null)
                {
                    ((IDisposable)message).Dispose();
                    message = null;
                }
            }
        }
示例#13
0
        /*
         * internal void Execute(QItemStream request, Stream stream)
         * {
         *  try
         *  {
         *      switch (request.Command)
         *      {
         *          case QueueCmd.Enqueue:
         *              MessageAckServer.WriteAck(stream, ExecSet(request), null);
         *              break;
         *          case QueueCmd.Dequeue:
         *          case QueueCmd.DequeuePriority:
         *          case QueueCmd.DequeueItem:
         *          case QueueCmd.Peek:
         *          case QueueCmd.PeekPriority:
         *          case QueueCmd.PeekItem:
         *              MessageAckServer.WriteResponse(stream, ExecGet(request), MessageState.Receiving);
         *              break;
         *          case QueueCmd.Commit:
         *
         *              break;
         *          case QueueCmd.Abort:
         *
         *              break;
         *
         *          //operation
         *          case QueueCmd.AddQueue:
         *              MQueue mq = null;
         *              MessageAckServer.WriteAck(stream, AddQueue(QProperties.Get(request.GetHeader()), out mq), null);
         *              break;
         *          case QueueCmd.RemoveQueue:
         *              MessageAckServer.WriteAck(stream, RemoveQueue(request.Host.HostName), null);
         *              break;
         *          case QueueCmd.HoldEnqueue:
         *              throw new Exception("Operation not supported");
         *          case QueueCmd.NoneHoldEnqueue:
         *              throw new Exception("Operation not supported");
         *          case QueueCmd.HoldDequeue:
         *              throw new Exception("Operation not supported");
         *          case QueueCmd.NoneHoldDequeue:
         *              throw new Exception("Operation not supported");
         *          case QueueCmd.EnableQueue:
         *              throw new Exception("Operation not supported");
         *          case QueueCmd.DisableQueue:
         *              throw new Exception("Operation not supported");
         *          //reports
         *          case QueueCmd.Exists:
         *              MessageAckServer.WriteAck(stream, Exists(request.Host.HostName), null);
         *              break;
         *          case QueueCmd.QueueProperty:
         *              throw new Exception("Operation not supported");
         *          case QueueCmd.ReportQueueList:
         *              GetQueueList();
         *              break;
         *          case QueueCmd.ReportQueueItems:
         *              throw new Exception("Operation not supported");
         *          case QueueCmd.ReportQueueStatistic:
         *              throw new Exception("Operation not supported");
         *          case QueueCmd.PerformanceCounter:
         *              throw new Exception("Operation not supported");
         *          case QueueCmd.QueueCount:
         *              MessageAckServer.WriteReport(stream, QueueCount(request.Host.HostName), QueueCmd.QueueCount, MessageState.Ok, null);
         *              break;
         *      }
         *  }
         *  catch (MessageException mex)
         *  {
         *      MessageAckServer.WriteError(stream, mex.MessageState, mex);
         *      Netlog.Exception("ExecGet MessageException: ", mex, true);
         *  }
         *  catch (ArgumentException ase)
         *  {
         *      MessageAckServer.WriteError(stream, MessageState.ArgumentsError, ase);
         *      Netlog.Exception("ExecGet ArgumentException: ", ase, true, true);
         *  }
         *  catch (SerializationException se)
         *  {
         *      MessageAckServer.WriteError(stream, MessageState.SerializeError, se);
         *      Netlog.Exception("ExecGet SerializationException: ", se, true);
         *  }
         *  catch (Exception ex)
         *  {
         *      MessageAckServer.WriteError(stream, MessageState.UnExpectedError, ex);
         *      Netlog.Exception("ExecGet Exception: ", ex, true, true);
         *  }
         *
         * }
         */
        internal NetStream ExecRequset(QItemStream request)
        {
            try
            {
                switch (request.Command)
                {
                case QueueCmd.Enqueue:
                    return(MessageAckServer.DoAck(ExecSet(request), null));

                case QueueCmd.Dequeue:
                case QueueCmd.DequeuePriority:
                case QueueCmd.DequeueItem:
                case QueueCmd.Peek:
                case QueueCmd.PeekPriority:
                case QueueCmd.PeekItem:
                    return(MessageAckServer.DoResponse(ExecGet(request), MessageState.Receiving));

                case QueueCmd.Commit:
                    break;

                case QueueCmd.Abort:
                    break;

                //operation
                case QueueCmd.AddQueue:
                    MQueue mq = null;
                    return(MessageAckServer.DoAck(AddQueue(new QProperties(request.GetBodyStream()), out mq), null));

                case QueueCmd.RemoveQueue:
                    return(MessageAckServer.DoAck(RemoveQueue(request.Destination), null));

                case QueueCmd.HoldEnqueue:
                    throw new Exception("Operation not supported");

                case QueueCmd.NoneHoldEnqueue:
                    throw new Exception("Operation not supported");

                case QueueCmd.HoldDequeue:
                    throw new Exception("Operation not supported");

                case QueueCmd.NoneHoldDequeue:
                    throw new Exception("Operation not supported");

                case QueueCmd.EnableQueue:
                    throw new Exception("Operation not supported");

                case QueueCmd.DisableQueue:
                    throw new Exception("Operation not supported");

                //reports
                case QueueCmd.Exists:
                    return(MessageAckServer.DoAck(Exists(request.Destination), null));

                case QueueCmd.QueueProperty:
                    throw new Exception("Operation not supported");

                case QueueCmd.ReportQueueList:
                    GetQueueList();
                    break;

                case QueueCmd.ReportQueueItems:
                    throw new Exception("Operation not supported");

                case QueueCmd.ReportQueueStatistic:
                    throw new Exception("Operation not supported");

                case QueueCmd.PerformanceCounter:
                    throw new Exception("Operation not supported");

                case QueueCmd.QueueCount:
                    return(MessageAckServer.DoReport(QueueCount(request.Destination), QueueCmd.QueueCount, MessageState.Ok, null));
                }
            }
            catch (MessageException mex)
            {
                Netlog.Exception("ExecGet MessageException: ", mex, true);
                return(MessageAckServer.DoError(mex.MessageState, mex));
            }
            catch (ArgumentException ase)
            {
                Netlog.Exception("ExecGet ArgumentException: ", ase, true, true);
                return(MessageAckServer.DoError(MessageState.ArgumentsError, ase));
            }
            catch (SerializationException se)
            {
                Netlog.Exception("ExecGet SerializationException: ", se, true);
                return(MessageAckServer.DoError(MessageState.SerializeError, se));
            }
            catch (Exception ex)
            {
                Netlog.Exception("ExecGet Exception: ", ex, true, true);
                return(MessageAckServer.DoError(MessageState.UnExpectedError, ex));
            }
            return(null);
        }
示例#14
0
        //[PermissionSet(SecurityAction.Assert, Unrestricted = true)]
        private void InternalStart()
        {
            try
            {
                //System.Security.SecurityRules(RuleSet=System.Security.SecurityRuleSet.Level2)

                //using (FileStream fs = new FileStream(@"D:\Nistec\Services\Logs\qlog.log", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))
                //{
                //    StreamWriter w = new StreamWriter(fs);     // create a Char writer
                //    w.BaseStream.Seek(0, SeekOrigin.End);      // set the file pointer to the end
                //    w.Write("log test" + "\r\n");
                //    w.Flush();  // update underlying file
                //}

                Netlog.Debug(serviceName + " start...");

                AgentManager.Start();

                //m_ServerEnqueue = new PipeServerEnqueue();
                //m_ServerEnqueue.Start(false);

                //m_ServerDequeue = new PipeServerDequeue();
                //m_ServerDequeue.Start(false);


                //if (AgentManager.Settings.EnableQueueManager)
                //{
                //    m_ServerQueueManager = new PipeServerManager();
                //    m_ServerQueueManager.Start(false);
                //}
                //if (AgentManager.Settings.EnableTcpListener)
                //{
                m_TcpServer = new TcpServerListener();
                if (m_TcpServer.Adapters.Count > 0)
                {
                    //m_TcpServer.Start();
                }

                m_TcpServer.Start();
                //}
                //if (AgentManager.Settings.EnableFolderListener)
                //{
                //    m_FolderServer = new FolderServerListener();
                //    m_FolderServer.Start();
                //}
                //if (AgentManager.Settings.EnableDbListener)
                //{
                //    m_DbServer = new DbServerListener();
                //    m_DbServer.Start();
                //}

                //svr.Start();//McLock.Lock.ValidateLock(), true);
                //host_serviceStart();
                Netlog.Debug(serviceName + " started!");
            }
            catch (Exception ex)
            {
                Netlog.Exception(serviceName + " InternalStart error ", ex, true, true);

                //File.AppendAllText(@"D:\Nistec\Services\MQueue.Agent\error.log", "error: " + ex.Message);
            }
        }