cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: connect failed if set socket non-blocking,why?

From: 黄志军 <hzhijun_at_huawei.com>
Date: Mon, 25 Oct 2004 19:47:29 +0800

----- Original Message -----
From: "Daniel Stenberg" <daniel-curl_at_haxx.se>
To: "libcurl development" <curl-library_at_cool.haxx.se>
Sent: Monday, October 25, 2004 7:07 PM
Subject: Re: connect failed if set socket non-blocking,why?

> On Mon, 25 Oct 2004, [utf-8] ??? wrote:
>
> > connect return value is -1 ,but errno is also 0, that is the key reason
> > puzzling me.
>
> Why is this a curl issue at all?
   Yes, the connect() is in the curl's connect.c file in 7.12.2 version.
>
> Yes, connect() can return -1 with errno set to 0. The program then needs to
> deal with it. libcurl does.
   The curl's mechanism is : after curl called connect(), if Curl_ourerrno()
   return errno is EINPROGRESS or EWOULDBLOCK , then it can use select()
   to do further job.
   
   But now after call connect(), Curl_ourerrno() return 0, then it run into default process.
   Actually,the http server for curl to connect is valid since in a single thread program, it
  works fine.
>
> --
> Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
> Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-10-25