[Prev][Next][Index][Thread]

wwwlib for Windows NT - does anybody have it working ?



I am using a little application that I found somewhere in these mail
groups to make a WWW client on Windows NT (3.50), using libwww (DLL's).
I got it working on a Sun and a SGI before, but on NT it crashes
(strangely enough after it has successfully read the data via TCP sockets,
in writing these data to a file, as I found when debugging).

I tried to make sure that I do not have a user-access problem (running
as administrator gives same problems and the file can surely be written).

So, my questions:
1. Should this combination (not) work ?:
- Libwww, version 4.0 Alpha 6
- Visual C++ 2.0 compiler (MicroSoft)
- Windows NT 3.50.

2. Which combination (including NT) do you have working ?
2a.  Could you provide a little sample program with it ?

Hereunder I include the test program, adapted from a program that
Gunnar R?nning (thanks, Gunnar!) once put here.
Any hints are welcome.

Thijs Ott de Vries
/*
Original application by Gunnar R?nning - found as message 4094
somewhere in these mailing groups.
Works and compiles on Sun an SGI, but I get crashes on NT 3.50.
In the debugger I can see that the last libWWW call - HTLoadAbsolute() - 
reads the data via the TCP port correctly, but then crashes in
trying to fwrite() the data to file (in HTFWriter_write(), HTFWrite.c).

I have used the following:
- LibWWW Version 4, Alpha release 6. DLL's made according to
  "Building Windows DLLs" spec (WWW_WIN_DLL, _WINDOWS, WWW_WIN_ASYNC).
  I tried both with and without the _CONSOLE #define, same effect.
- Visual C++ 2.0 compiler
- Windows NT 3.50
*/

#define	_WINDOWS

#include <stdio.h>
#include "WWWLib.h"
#include "HTHome.h"
#include "HTTP.h"

main()
{
 	char *url = "http://172.16.38.162/";	/* EMWAC server on my NT machine,
other URL's tried as well */
	FILE *fp;
	PRIVATE HTRequest * request;
	PRIVATE HTList * c = NULL;

	c = HTList_new();
	HTLibInit("todv", "0.1");
	HTProtocol_add("http", YES, HTLoadHTTP);
	HTNetCall_addBefore(HTLoadStart, 0);
	HTNetCall_addAfter(HTLoadTerminate, HT_ALL);

	if( (fp = fopen("foo.txt", "w")) == NULL){
		return 0;
	}

fprintf(fp, "Test to write to foo.txt\n");
fflush(fp);

/* This text actually appears in the file, so no write-access problems it
seems */

	request = HTRequest_new();
	HTRequest_setMethod(request, METHOD_GET);
	HTRequest_setOutputStream(request,HTFWriter_new(fp, NO));
	HTRequest_setOutputFormat(request, WWW_SOURCE);
	HTRequest_setPreemtive (request, 1);
	printf("Loading URL %s\n", url);

	HTLoadAbsolute(url, request);		/* crashes in writing to file */

	fclose(fp);
}