首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

the operation timed out 异常 高手帮看上

2012-11-13 
the operation timed out 错误高手帮看下m_strStatus正在连接到服务器...UpdateData(FALSE)CHttpFile

the operation timed out 错误 高手帮看下
m_strStatus="正在连接到服务器...";
UpdateData(FALSE);
CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_GET,m_strIniPath, NULL, 1, NULL, NULL, m_dwHttpRequestFlags); 
AfxMessageBox(m_strIniPath);  
AfxMessageBox(m_strServer);
AfxMessageBox(m_dwPort);
if(!pFile->SendRequest()) //出错的位置
{
AfxMessageBox("test1");
m_strStatus="连接服务器失败!";
UpdateData(FALSE);
AfxMessageBox("test2");
pFile->Close();
return;
}

不知道什么原因,前面的信息都正确。就是连接不上。

是一个自动更新模块 首先是要连接到网络上的ini文件, 也就是连接网络ini文件的地方出错了。

[解决办法]
就是超时了,应该是抛出了一个异常
[解决办法]
try
{
if(!pFile->SendRequest()) //出错的位置
{
AfxMessageBox("test1");
m_strStatus="连接服务器失败!";
UpdateData(FALSE);
AfxMessageBox("test2");
pFile->Close();
return;

}
catch( CInternetException &e)
{
//打印信息
}
[解决办法]
难道抛出的是指针?
try
{
if(!pFile->SendRequest()) //出错的位置
{
AfxMessageBox("test1");
m_strStatus="连接服务器失败!";
UpdateData(FALSE);
AfxMessageBox("test2");
pFile->Close();
return;
}
}
catch( CInternetException *e)
{
//打印信息
}
catch(...)
{
AfxMessageBox(_T("未知异常"));
}

热点排行