cURL / Mailing Lists / curl-library / Single Mail


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

From: Daniel Stenberg <>
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.

List admin:
Received on 2012-10-25