SendRequest Hangs

Hello,

My "monitoring" application checks the status of other web services to make sure they are up and able to respond by sending HTTP requests to them every so often.

The problem is - if one of the web services falls into a "locked" state and doesn't respond - so does the monitoring application! I've isolated it down the SendRequest() call - it just gets stuck and hangs for what appears to be forever (didn't release overnight). I've set just about every timeout I can find, but nothing seems to be working. Help!

//Create Internet Session object//
CInternetSession* m_pSession = new CInternetSession();

if (m_pSession == NULL)
{
CString sError = "Unable to create new CInternetSession object";
MonitorLog(sError);
return FALSE;
}

//Set Every time out I can find//

m_pSession->SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5000);
m_pSession->SetOption(INTERNET_OPTION_RECEIVE_TIMEOUT, 5000);
m_pSession->SetOption(INTERNET_OPTION_SEND_TIMEOUT, 5000);
m_pSession->SetOption(INTERNET_OPTION_CONNECT_BACKOFF, 5000);
m_pSession->SetOption(INTERNET_OPTION_DATA_SEND_TIMEOUT, 5000);
m_pSession->SetOption(INTERNET_OPTION_DATA_RECEIVE_TIMEOUT, 5000);
m_pSession->SetOption(INTERNET_OPTION_CONNECT_RETRIES, 1);

CHttpConnection* m_pServer = NULL;
CHttpFile* m_pFile = NULL;

//Make the HTTP Connection (works)//

MonitorLog("Making HTTP Connection");
m_pServer = m_pSession->GetHttpConnection(strServerName, nPort);
if (! m_pServer)
{
CString sError = "Failed to Connect to Server : " + strServerName;
MonitorLog(sError);
goto FAIL;
}

//Open request (works)//

MonitorLog("Opening Request");
m_pFile = m_pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET, strObject,NULL, 1, NULL, NULL, INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT | INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_SECURE | INTERNET_FLAG_IGNORE_CERT_DATE_INVALID | INTERNET_FLAG_IGNORE_CERT_CN_INVALID);
if (! m_pFile)
{
CString sError = "Failed to Open Request : " + strObject;
MonitorLog(sError);
goto FAIL;
}

//Sending Request (HANGS IF SERVICE IS LOCKED!!!!!)//

MonitorLog("Sending Request");
if (!(m_pFile->SendRequest()))
{
CString sError = "Failed to Send Request to Server";
MonitorLog(sError);
goto FAIL;
}
[2533 byte] By [mjxnjx] at [2007-11-20 1:35:36]