Exemple #1
0
        public bool StartServer(string strEventName, string strPipeName, CMD_CALLBACK_PROC pfnCmdProc, object pParam, ThreadPriority iThreadPriority, int iCtrlCmdEventID)
        {
            if (pfnCmdProc == null || strEventName.Length == 0 || strPipeName.Length == 0)
            {
                return false;
            }
            if (m_ServerThread != null)
            {
                return false;
            }

            PipeServerThread RunThread = new PipeServerThread(m_hStopEvent);
            RunThread.m_pCmdProc = pfnCmdProc;
            RunThread.m_pParam = pParam;
            RunThread.m_strEventName = strEventName;
            RunThread.m_strPipeName = strPipeName;
            RunThread.m_iCtrlCmdEventID = iCtrlCmdEventID;

            CommonUtil._ResetEvent(m_hStopEvent);
            m_ServerThread = new Thread(new ThreadStart(RunThread.Run));
            m_ServerThread.Priority = iThreadPriority;
            m_ServerThread.Start();

            return true;
        }
Exemple #2
0
        public bool StartServer(string strEventName, string strPipeName, CMD_CALLBACK_PROC pfnCmdProc, object pParam, ThreadPriority iThreadPriority, int iCtrlCmdEventID)
        {
            if (pfnCmdProc == null || strEventName.Length == 0 || strPipeName.Length == 0)
            {
                return(false);
            }
            if (m_ServerThread != null)
            {
                return(false);
            }

            PipeServerThread RunThread = new PipeServerThread(m_hStopEvent);

            RunThread.m_pCmdProc        = pfnCmdProc;
            RunThread.m_pParam          = pParam;
            RunThread.m_strEventName    = strEventName;
            RunThread.m_strPipeName     = strPipeName;
            RunThread.m_iCtrlCmdEventID = iCtrlCmdEventID;

            CommonUtil._ResetEvent(m_hStopEvent);
            m_ServerThread          = new Thread(new ThreadStart(RunThread.Run));
            m_ServerThread.Priority = iThreadPriority;
            m_ServerThread.Start();

            return(true);
        }