On Sun, Mar 20, 2011 at 9:23 PM, ajil koshy <[email protected]> wrote:
> Hi, > > 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 libcurl. > > 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 > advance. > > Thanks > Ajil Koshy > > ------------------------------------------------------------------- > List admin: http://cool.haxx.se/list/listinfo/curl-library > Etiquette: http://curl.haxx.se/mail/etiquette.html > If i may ask. Do you really need this communication to be done over http? It sounds that non-http (regular socket?) server/client app suits your case better. Just a piece of my mind :) *Amr*
------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
