cURL / Mailing Lists / curl-users / Single Mail

curl-users

FW: Curl_Multi_Info_Read

From: <Priya.Ramakrishnan_at_WellsFargo.COM>
Date: Thu, 11 Jul 2002 17:09:08 -0700

HI
I am trying to send 6 messages at a time. I am not getting any successful
responses in the msgStruct. I get only when there are exceptions. Any clue
why this is happening. DO i need to change how i have coded. I would really
appreciate if you can give me a hint.

Thank You
Priya Ramakrishnan

Ph:415 396 8985

-----Original Message-----
From: Ramakrishnan, Priya
Sent: Tuesday, July 09, 2002 5:38 PM
To: Curl Mailinglist
Subject: Curl_Multi_Info_Read

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
PC Mods, Computing goodies, cases & more
http://thinkgeek.com/sf
Received on 2002-07-12