cURL / Mailing Lists / curl-library / Single Mail

curl-library

Trouble getting started... (couldn't connect to host)

From: Sara <me_at_sarahedfors.se>
Date: Wed, 8 Sep 2010 18:56:50 +0000 (UTC)

Hi,

I need to make a program in C communication over HTTP (using SOAP-protocol). I
am a beginner at the subject, and I have problems getting started with libcurl.

I wanted to start simple, so I slightly modyfied the example simple.c:

===============================================

#include <stdio.h>
#include <curl/curl.h>
 
int main(void)
{
  CURL *curl;
  CURLcode res;

  curl = curl_easy_init();
  if(curl)
  {
    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
    curl_easy_setopt(curl, CURLOPT_URL, "google.com");
    res = curl_easy_perform(curl);

    if(CURLE_OK != res)
    {
       printf("Error: %d\n", res);
       return 1;
    }

     /* always cleanup */
     curl_easy_cleanup(curl);
  }

  return 0;
}

===============================================

I can compile ok, but when I run the program I get this output:

* About to connect() too google.com port 80 (#0)
* couldn't connect to host
* Closing connection #0
* Couldn't connect to server
Error 7

I have tried to sniff the TCP/IP-traffic using SmartSniff, but nothing is
detected while running my program.

I use Code::Blocks 10.05, Windows 7 and curl-7.21.1-devel-mingw32.

Do anyone have any tip of how I can move on and solve the problem??
Kind Regards

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-09-08