cURL / Mailing Lists / curl-library / Single Mail


Re: simple chat example without using curl_easy_send and curl_easy_recv

From: Daniel Stenberg <>
Date: Mon, 30 May 2011 10:45:32 +0200 (CEST)

On Mon, 30 May 2011, swathi upadhyaya wrote:

> I tried sendrecv example from [ as in
> This example uses curl_easy_send and curl_easy_recv on raw socket. I would
> like to use CURLOPT_POST to send and CURLOPT_WRITEFUNCTION to recv data.

Then that seems like a rather poor example to base your work on... You
obviously don't want curl_easy_send and curl_easy_recv!

> But this is not working. It always fetches the home page of server.

"This" ? You're seriously telling us that a code you wrote doesn't work, and
then you just show us a very small snippet from that and expect us to
understand enough to tell you what's wrong in your application?

Please, tell us A LOT MORE and we might in fact be able to help out a lot.

> Tried CURLOPT_NOBODY then recv buffer will be 0 bytes

CURLOPT_NOBODY over HTTP implies a HEAD request and yes, then there should be
no body returned.

> const char *request = "GET /index1.html HTTP/1.1\r\nHost:

> curl_easy_setopt(curl, CURLOPT_URL, "");
> curl_easy_setopt(curl, CURLOPT_POST, 1L);
> curl_easy_setopt(curl, CURLOPT_POSTFIELDS, request);

That is indeed a funny post body you're sending, but it's not really wrong and
neither are the other options. IOW: the particular options are not what cause
your problems.

List admin:
Received on 2011-05-30