cURL / Mailing Lists / curl-library / Single Mail


Need help for implementing full duplex support using libcurl

From: ajil koshy <>
Date: Mon, 21 Mar 2011 00:53:28 +0530


I have just started using libcurl library. I had a question about how we can
implement full duplex communication using libcurl library. I have writting
an HTTP client and server application. The client is implemented using

The client and server are intended to have bi-directional communication in
the following fashion. It will consist of one HTTP request-response exchange
between client server using HTTP pipe-lining.

1) Client opens a TCP connection to the server.
2) Client sends an HTTP request header that includes
“transfer-encoding:chunked” header. Since it is chunked transfer, the client
may further send any data that it intends the server to receive and finally
send a 0 length packet when it is done sending.
3) On receiving first HTTP request, server sends back an HTTP response
header containing “transfer-encoding:chunked”. As in case of the client, it
can now send all the data it wishes client ot receive in the form of chunks
and finally send a 0 length chunk.

The problem is my client should be able to send and receive data
simultaneously over the TCP connection that has been opened with server.
Obviously, this cannot be done on a single thread as my send/recv calls will
be serialized. As per documentation, libcurl easy handle cannot be shared
across threads. So is there a way this can be done? I am using
curl_easy_send () and curl_easy_recv () functions and constructing HTTP
headers by myself.

I have read that pipe-lining is supported only using the multi-interface.
However, I could not find an example of full-duplex communication in the
list of source examples. Please let me know if this is possible. Thanks in

Ajil Koshy

List admin:
Received on 2011-03-20