1 UINT CNrcServer::Run(LPVOID pParam) {<br>     //通过丝程传入当前类的地址
 2     CNrcServer* pNrcServer = (CNrcServer*)pParam;
 3     while(1) {<br> 
        //获取当前系统时间 4 DWORD currentTime = GetTickCount();<br> 
       /* m_dwLastPlayingTime 是在一个网络正常运行线程函数中定义的变量 m_dwLastPlayingTime = GetTickCount();*/
 5     signed int intervalTime = currentTime - pNrcServer->m_dwLastPlayingTime;

     /* <br> 对获取的时间作为比较,如果大于5秒,视为网络断线*/
 6         if (intervalTime > 5000) {
 7             pNrcServer->m_bNetWorkstate = FALSE;
 8             Sleep(1000);
 9             pNrcServer->m_bNetworkFlag = FALSE;
10             AfxEndThread(0);
11         }
12     }
13     return 0;
14 }

 

posted on 2013-07-09 11:37  stay hungry!  阅读(157)  评论(0)    收藏  举报