cURL / Mailing Lists / curl-library / Single Mail

curl-library

How to interrupt waitconnect()

From: Hanno L. Kranzhoff <kranzhoff_at_neptunelabs.com>
Date: Tue, 11 Jun 2002 11:49:26 +0200

Hi,
this might be a stupid question, but I didn't find an
appropriate answer to it for a long time now.
I'm using libcurl's easy interface (currently 7.9.6)
with vc6 on win32 to accomplish HTTP form posts.
curl_easy_perform() is being called inside a single thread to avoid
blocking. Everything works fine except when I try to connect
to a non-existing/unreachable server. I know that CURLOPT_CONNECTTIMEOUT

specifies the time waitconnect() may take to connect to the
server.
But: Is there any way of interrupting waitconnect() before the
timeout occurs? Let's say because the user wants to cancel
the operation immediately?

The only solutions I can think of right now are:
1) Simply killing the thread, but there has to be
a more elegant (and safer) way.
2) Set CURLOPT_CONNECTTIMEOUT to 1 sec and let
curl_easy_perform() fail silently for multiple times
before displaying an error. This could lead to problems
with slow connections I guess.

Any hints greatly appreciated,

-- 
Hanno L. Kranzhoff
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink
Received on 2002-06-11