Re: write callback issues (was Re: A new problem)
Date: Fri, 4 Apr 2008 10:51:21 +0530 (IST)
On Thu, 3 Apr 2008, Daniel Egger wrote:
> The memset is kinda redundant. And a usual snprintf will only output
> data til it finds a \0 in the buffer which might or might not happen
> in your case. A memcpy might be more useful in this case.
> Also the allocation happening in the recv function strikes me a little
> odd plus there's no data being exchanged with the outside which is kinda
> You could as well just use the curl buffer without any further code.
Well folks, you seem to have missed the *actual* problem. It's
not with the function, but the way it is invoked by libcurl.
The problem is, recv_data(...) gets invoked by libcurl even before the
http response is sent/dispatched by the server.
See, The `nc(1)' acts as my server(cmd: $ nc -vl <port>). When
curl_easy_perform() does my POST request, nc merely displays it on the
console, then I manually type the response to nc, which it gracefully
sends back to my application where libcurl is suppose to be waiting for
the response, right?...with me till here??
But what happens is, as soon as libcurl does the POST, instead of waiting
for my reply, it goes ahead and calls the recv_data(...) and boom...
Hope I'm clear enough..thank you!
-- Regards - PrasadReceived on 2008-04-04