curl-users
Curl_Multi_Info_Read
Date: Tue, 9 Jul 2002 17:37:35 -0700
Hi
I am trying to send two posts and expecting a response from the server or
atleast an exception.
But when i try to use from Multi_Info_Read i get only one message usually.
This is the code snippet i am using. Is there something i can change. I am
using Curl 7.9.8 and working on Windows for now.
std::map<long, struct PostDataStruct>::iterator iter =
m_postMap.find(requestId);
if (iter != m_postMap.end() ) // found
{
if (m_postMap[requestId].m_result == BCA::NOTDONE)
{
CURLMcode returnCode = curl_multi_perform(m_pMultiCurl,
&stillRunning);
std::cout << stillRunning << std::endl;
int msgs_in_queue=0;
CURLMsg *msgStruct=NULL;
msgStruct = curl_multi_info_read(m_pMultiCurl, &msgs_in_queue);
while (msgStruct != NULL)
{
std::map<long, struct PostDataStruct>::iterator mapItr;
for (mapItr = m_postMap.begin(); mapItr != m_postMap.end();
mapItr++)
{
if (msgStruct->easy_handle == (mapItr->second).curlHandle)
{
curl_multi_remove_handle(m_pMultiCurl,
m_postMap[requestId].curlHandle);
curl_easy_cleanup(m_postMap[requestId].curlHandle);
if (msgStruct->data.result > CURLE_OK)
{
(mapItr->second).m_result = BCA::EXCEPTION;
}
else
{
(mapItr->second).m_result = BCA::DONE;
}
}
}
msgStruct = curl_multi_info_read(m_pMultiCurl, &msgs_in_queue);
}
if ((returnCode == CURLM_OK) )&& (stillRunning == 0))
return true;
}
switch(m_postMap[requestId].m_result)
{
case BCA::DONE : return true;
case BCA::NOTDONE : return false;
case BCA::EXCEPTION : throw
HttpWException(std::string(m_postMap[requestId].errBuffer));
default : return false;
}
}
else
{ // not found
throw HttpWException("Not a Valid Request ");
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Stuff, things, and much much more.
http://thinkgeek.com/sf
Received on 2002-07-10