Esempio n. 1
0
        //int gnSessInterval;
        static void Main(string[] args)
        {
            //SOCK_INFO stSrvSock = new SOCK_INFO();
            //SOCK_INFO stCliSock = new SOCK_INFO();
            //SOCKET_MGR objSockMgr = new SOCKET_MGR();
            stSrvSock  = new SOCK_INFO();
            stCliSock  = new SOCK_INFO();
            objSockMgr = new SOCKET_MGR();

            //LprsToServerCOMMON objLtoS = new LprsToServerCOMMON();

            double ldInterval = 1000 * 10;

            stSrvSock.objLock = new object();
            stCliSock.objLock = new object();

            objSockMgr.connSocket(ref stSrvSock, ref stCliSock);

            setSessionCheckTimer(ldInterval);

            do_MainThread();

            // working main thread
            objSockMgr.closeSocket(ref stSrvSock);
            objSockMgr.closeSocket(ref stCliSock);
        }
Esempio n. 2
0
        private static string chkInstruction(byte[] szRecvBuff, ref SOCK_INFO stSock)
        {
            string strBuff;
            string strRet;

            strBuff = Encoding.ASCII.GetString(szRecvBuff);

            if (strBuff.Contains("LPRS|"))
            {
                //objRecogResult.getRecogResult(ref stRecogResult, ref szRecvBuff);
                strRet = "LPRS|";
            }
            else if (strBuff.Contains("ST|"))
            {
                // re-up coonnection check flag
                lock (stSock.objLock)
                {
                    stSock.lnResetTime = DateTime.UtcNow.Ticks;
                    stSock.bConn       = true;
                }

                //objStatInfo.getStatInfo(ref stStatInfo, ref szRecvBuff);
                strRet = "ST|";
            }
            else
            {
                strRet = "INVALID_STRUCTION";
            }

            return(strRet);
        }
Esempio n. 3
0
 public void recvThread(ref SOCKET_MGR objSockMgr, ref SOCK_INFO stCliSock, bool bBackGround)
 {
     /*RecvDelegate dlgRecv = new RecvDelegate(objSockMgr.recvMsg);
      * //Thread objRecvThrd = new Thread(new ParameterizedThreadStart(dlgRecv));
      * Thread objRecvThrd = new Thread(() => dlgRecv(ref stCliSock));
      * if (bBackGround == true)
      *  objRecvThrd.IsBackground = bBackGround;
      * objRecvThrd.Start(ref stCliSock);*/
 }