读书人

the operation timed out 异常 高手帮

发布时间: 2012-11-13 10:00:50 作者: rapoo

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("未知异常"));
}

读书人网 >VC/MFC

热点推荐