Beispiel #1
0
        /// <summary>
        /// Connect to the server
        /// </summary>
        /// <param name="ops">the client options</param>
        /// <param name="waitTimeInMilliSec"> the wait time for connection in milli-second.</param>
        public void Connect(IpcClientOps ops, int waitTimeInMilliSec)
        {
            lock (m_generalLock)
            {
                if (IsConnected())
                {
                    return;
                }
            }

            if (ops == null)
            {
                ops = IpcClientOps.defaultIpcClientOps;
            }
            if (ops.m_callBackObj != null)
            {
                throw new ArgumentException("callBackObj is null!");
            }
            lock (m_generalLock)
            {
                m_options = ops;
                if (ops.m_numOfWriteBytes == 0)
                {
                    m_options.m_numOfWriteBytes = IpcConf.DEFAULT_WRITE_BUF_SIZE;
                }
                if (ops.m_numOfReadBytes == 0)
                {
                    m_options.m_numOfReadBytes = IpcConf.DEFAULT_READ_BUF_SIZE;
                }
            }
            m_readBuffer = new byte[m_options.m_numOfReadBytes];
            m_connectWaitTimeInMillisec = waitTimeInMilliSec;
            Start();
        }
Beispiel #2
0
        /// <summary>
        /// Connect to the server
        /// </summary>
        /// <param name="ops">the client options</param>
        /// <param name="waitTimeInMilliSec"> the wait time for connection in milli-second.</param>
		public void Connect(IpcClientOps ops, int waitTimeInMilliSec)
        {
            lock (m_generalLock)
            {
                if (IsConnected())
                    return;
            }

            if (ops == null)
                ops = IpcClientOps.defaultIpcClientOps;
            if (ops.m_callBackObj != null)
                throw new ArgumentException("callBackObj is null!");
            lock (m_generalLock)
            {
                m_options = ops;
                if (ops.m_numOfWriteBytes == 0)
                    m_options.m_numOfWriteBytes = IpcConf.DEFAULT_WRITE_BUF_SIZE;
                if (ops.m_numOfReadBytes == 0)
                    m_options.m_numOfReadBytes = IpcConf.DEFAULT_READ_BUF_SIZE;

            }
            m_readBuffer = new byte[m_options.m_numOfReadBytes];
            m_connectWaitTimeInMillisec = waitTimeInMilliSec;
            Start();

        }