W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2002

Http Server

From: <chilaf@libero.it>
Date: Wed, 27 Feb 2002 16:00:47 +0100
Message-Id: <GS75PB$IK0cLOKLLk66XdHhWMVnN0_hjOp9OqCrv4U8qtKLTA@libero.it>
To: www-lib@w3.org
Hi,
I tried to run an httpserver example,
but It Does'nt work : no action when client connect.
I test in local mode using : http://localhost:6000 (port 6000)
I read the Doc HTAcces.html , section : "Serve a Request" and I did all
It's explaned there.
I began with the listen.c example and I modified to my work.
Following the seignificative code.
SomeOne Can help me?
Thanks in advance

main()
{
.......
    /* Set up a tool to listen on this port */
    if (ms->port >= 0) {

	/* Register TCP as the transport */
	HTTransport_add("tcp", HT_TP_SINGLE, HTReader_new, 
HTWriter_new);

	HTProtocol_add("http", 	"tcp", ms->port,	NO,	NULL,
	HTServHTTP);

	/* Set up the request */
	ms->request = HTRequest_new();
	HTRequest_setOutputFormat(ms->request, DEFAULT_FORMAT);
	HTRequest_setOutputStream(ms->request,
				  HTFWriter_new(ms->request, OUTPUT, 
YES));

	/* Start listening on the socket */
	HTPrint("Listening on port %d\n", ms->port);
	if ((status = HTServeAbsolute("http://localhost:6000", ms-
>request)) == NO) {
	    HTPrint("Can't listen on port %d\n", ms->port);
	    Cleanup(ms, -1);
	}

	/* Go into the event loop... */
	if (status == YES) HTEventList_newLoop();
    }
    Cleanup(ms, 0);
    return 0;
} // end main
Received on Wednesday, 27 February 2002 10:00:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:40 GMT