读书人

internetsession类连接代码错误如何会

发布时间: 2013-07-08 14:13:00 作者: rapoo

internetsession类连接代码异常怎么会被触发?


CString command;
UINT ret = 0;
command.Format("%s%d","/-wvhttp-01-/video.cgi?v=h264&duration",duration);
CInternetSession inet = CInternetSession(_T("SimpleH264DataExtract"));
CHttpConnection* pHttpCon = inet.GetHttpConnection(hostIp,CHttpConnection::HTTP_VERB_GET
,80,NULL,NULL);
CHttpFile* pFile = pHttpCon->OpenRequest(CHttpConnection::HTTP_VERB_GET,
command,NULL,1,NULL,_T("HTTP/1.1"),NULL);
try{
pFile->SendRequest();
}
catch(CInternetException* e)
{
CString err;
TCHAR buf[512];
e->GetErrorMessage(buf,512);
err.Format(_T("Error occurred:%d/ %s\n"),e->m_dwError,buf);
::AfxMessageBox(err,MB_OK|MB_ICONEXCLAMATION);
ret = -1;
goto EXIT;
}



[解决办法]
CInternetSession::GetHttpConnection
这个也可能会触发CInternetException异常,也需要try{}catch()捕获~
[解决办法]
问的啥条件发生异常啊
引用:
CInternetSession::GetHttpConnection
这个也可能会触发CInternetException异常,也需要try{}catch()捕获~

读书人网 >VC/MFC

热点推荐