cURL / Mailing Lists / curl-library / Single Mail

curl-library

connect failed if set socket non-blocking,why?

From: 黄志军 <hzhijun_at_huawei.com>
Date: Mon, 25 Oct 2004 16:57:00 +0800

I link my program with static library libcurl.a and find it always return CURLE_COULDNT_CONNECT.

if i ignore function Curl_nonblock() in connect.c( curl-7.12.2), the curl_easy_perform return success and works fine.

But if set socket to non-blocking, the connect() return -1(rc = -1)

and i got the following info: "errno in curl=0" and "errno out curl=150", why?

/*../lib/connect.c*/
/* set socket non-blocking */
  Curl_nonblock(sockfd, TRUE);

  rc = connect(sockfd, ai->ai_addr, ai->ai_addrlen);
  
  fprintf(stderr, "errno in curl=%d\n", errno);

  if(-1 == rc) {
    error = Curl_ourerrno();
  fprintf(stderr, "errno in curl=%d\n", errno);

/*my multi-thread program:*/
curl_easy_perform(curl);
fprintf(stderr, "errno out curl=%d\n", errno);
Received on 2004-10-25