W3C home > Mailing lists > Public > www-lib@w3.org > October to December 2005

I need some help with libwww

From: Ivan Tarapov <itarapov@telcos.net.ua>
Date: Wed, 30 Nov 2005 20:52:12 +0200
To: "libwww w3c" <www-lib@w3.org>
Message-Id: <20051130185211.A6D6DCCEA6@mail.telcos.net.ua>


I have been trying to grasp the libwww concepts for several days already,
but they still remain very vague to me. 

There are several questions I'd like to see answers to:


1. I have been trying to launch a sample application - the one that counts
number of bytes in the body


#define url "http://www.google.com"


int main()


      HTRequest * request;


      HTProfile_newPreemptiveRobot("TestApp", "1.0");

      request = HTRequest_new();

      HTRequest_setOutputFormat(request, WWW_SOURCE);


      if (url && *url) {

            HTParentAnchor *

            BOOL status =


                  HTContentCounter(&readerStream, request,0x2000),


            if (status)

                  printf("Content length found to be %ld bytes\n",



                  printf("Content length could not be found\n");

      } else

            printf("Bad parameters - please try again\n");


      HTRequest_delete(request);               /* Delete the request object


return 0;



The code is executed, however I get an error message in trace output

TRACE: Error....... Add  73     Severity: 1     Parameter: `WinSock reported
error=10093'       Where: `gethostbyname'


and, the content length is found to be -1. 

Error 10093 means that WinSock hasn't been initialized. 

Does this mean that the example was wrong? Or it was I who missed something?


2. How should I handle errors in libwww? For example, what should I add to
the above mentioned code to handle connection reset? Absence of connection?
Invalid address? Invalid DNS record etc. Is there a single mechanism like
Win32's GetLastError() or there is a separate scenario for each error?


3. I'd very much appreciate if someone had written me a simple program that
would issue GET request to a particular server on a particular port with
several headers that are set manually and print a response from server to
the console.



I hope for your help as I feel like I'm at complete loss with libwww


Thank you,

Received on Wednesday, 30 November 2005 19:53:00 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:56 UTC