cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Sleep and wakeup on http request AND communication socket number

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 25 Oct 2012 12:49:28 +0200 (CEST)

On Thu, 25 Oct 2012, JALINDAR wrote:

> I got to know how to open know socket number using CURLOPT_LOCALPORT but how
> to wait on this socket?

libcurl opens its own sockets normally. CURLOPT_LOCALPORT is used to make
libcurl bind the local end of the socket to a specific port.

Use the multi / multi_socket API to wait for sockets in your application and
use libcurl in a non-blocking fashion.

> my design intention is to sleep on this opened socket till i get any
> communication request form server..

You'd use select(), curl_multi_wait() or an event based system with
multi_socket for that purpose.

We have examples showing all of those in use I believe.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-10-25