curl-library
Re: a question about using libcurl two threads
Date: Wed, 08 Sep 2004 09:21:02 +0100
Hi,
You can use curl_multi_fdset() to get the sockets for a connection, then
put them into nonblocking mode and call select your self on them.
This should do the trick
Andy
On Wed, 2004-09-08 at 03:36, 黄志军 wrote:
> Now i am testing to use libcurl(curl-7.12.0 ) and i am wonder whether
> libcurl can support the followings,
> anyone presents me explanation or example is appreciated.
>
> I want to design a communication module to transfer messages between
> a TCP side and a http server.
> I will create two threads. One thread's function is to send the
> message which got from the TCP side to the http server
> whenever my module got them. The other thread will keep receiving the
> response messages from the http server.
> So , i wonder whether libcurl api can support the nonblocking sending
> and use the similar method like select
> to receive the response message from the httpserver.
>
> I want to adopt this kind of mechanism since maybe there are many TCP
> messages got at the same time
> and my module should send them out to the corresponding HTTP server
> one by one without blocking to
> receive any of the response. Then i use another thread to do the
> receiving job which avoid blocking
> others' sending when any one or more of the HTTP server response slow
> or timeout.
>
> Regards
> Thks.
-- Andy hobbs <andy_at_trogs.org.uk>Received on 2004-09-08