curl-library
Re: getting error in curl_easy_perform
Date: Wed, 29 Dec 2010 17:13:35 -0500
On Wed, Dec 29, 2010 at 5:10 PM, amit paliwal <amit.ambitions_at_gmail.com>wrote:
>
>
> On Wed, Dec 29, 2010 at 4:56 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
>
>> On Wed, 29 Dec 2010, amit paliwal wrote:
>>
>> I am getting "No such process" error when curl_easy_perform() gets
>>> executed. here are the steps i am doing:
>>>
>>
>> Can you please show us a complete example and do tell us what libcurl
>> version on what OS you're using!
>>
>> Alternatively, I suggest using CURLOPT_VERBOSE to figure out more, or even
>> using strace to see exactly what system call that fails...
>>
>
> Reply: I am using it on linux (ubuntu). As mentioned in the documentation
> CURLOPT_URL is mandatory step. So, I did something like curl_easy_setopt(
> ctx , CURLOPT_URL, "http://localhost:4433" ) ; .
>
> To test basic stuff I am running Client and server on the same machine and
> trying to communicate between them on loopback. Server is listening on
> 127.0.0.1 and port 4433 as it is on loopback.
>
> I am using curl-7.21.2.
>
Complete example is:
void *SessionThread(void *parm)
{
CURL *ctx;
CURLcode res;
int sockfd; /* socket */
size_t iolen;
curl_global_init( CURL_GLOBAL_ALL ) ;
ctx = curl_easy_init() ;
if( NULL == ctx )
{
}
curl_easy_setopt( ctx , CURLOPT_URL, "http://localhost:4433" ) ;
curl_easy_setopt(ctx, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_easy_setopt( ctx , CURLOPT_WRITEDATA ,ctx);
/* Set DAPro Parser's static function as write callback.
*/
curl_easy_setopt( ctx , CURLOPT_WRITEFUNCTION , write_data );
/* Set the Callback function to be called when CURL receives some HTTP
header
*/
curl_easy_setopt(ctx, CURLOPT_HEADERFUNCTION, headercb);
/* Get curl handle here
* If return type is not CURLE_OK log error
*/
res = curl_easy_perform(ctx);
if(CURLE_OK != res)
{
printf("\nError: %d::%s\n", res,strerror(res));
}
}
It prints error number as 7 which means not connected
>
>> --
>>
>> / daniel.haxx.se
>> -------------------------------------------------------------------
>> List admin: http://cool.haxx.se/list/listinfo/curl-library
>> Etiquette: http://curl.haxx.se/mail/etiquette.html
>>
>
>
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-12-29