Help. about fascgi.thanks you.

Just starting out? Need help? Post your questions and find answers here.
ruyi7952
User
User
Posts: 11
Joined: Thu Jan 21, 2010 5:27 pm

Re: Help. about fascgi.thanks you.

Post by ruyi7952 »

Hi Trond.

thanks for your reply.

socket??? then are fastcgi_app mode.

I want to write a stdio mode fastcgi,stdio mode needed socket too????

please.
The I/O Libraries
The FastCGI Software Development Kit that accompanies Open Market WebServer 2.0 includes I/O libraries to simplify the job of converting existing CGI applications to FastCGI or writing new FastCGI applications. There are two libraries in the kit: fcgi_stdio and fcgiapp. You must include one of these header files in your program:





fcgi_stdio.h
fcgiapp.h
The fcgi_stdio library is a layer on top of the fcgiapp library, and we recommend strongly that you use it, both for converting existing CGI applications and for writing new FastCGI applications. The fcgi_stdio library offers several advantages:





Simplicity: there are only 3 new API calls to learn
Familiarity: If you are converting a CGI application to FastCGI, you will find few changes between CGI and FastCGI. We designed our library to make the job of building a FastCGI application as similar as possible to that of building a FastCGI application: you use the same environment variables, same techniques for parsing query strings, the same I/O routines, and so on.
Convenience: the library provides full binary compatibility between CGI and FastCGI. That is, you can run the same binary as either CGI or FastCGI.
The fcgiapp library is more specific to FastCGI, without trying to provide the veneer of familiarity with CGI. This manual describes the fcgi_stdio library; the fcgiapp library is documented in the header files that accompany the development kit.
Example 1: TinyFastCGI
Here is a simple example of a responder FastCGI application written in C:

Code: Select all

#include "fcgi_stdio.h" /* fcgi library; put it first*/
#include <stdlib.h>

int count;

void initialize(void)
{
  count=0;
}

void main(void)
{
/* Initialization. */  
  initialize();

/* Response loop. */
  while (FCGI_Accept() >= 0)   {
    printf("Content-type: text/html\r\n"
           "\r\n"
           "<title>FastCGI Hello! (C, fcgi_stdio library)</title>"
           "<h1>FastCGI Hello! (C, fcgi_stdio library)</h1>"
           "Request number %d running on host <i>%s</i>\n",
            ++count, getenv("SERVER_HOSTNAME"));
  }
}

printf() it's not stdin/stdout function???
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: Help. about fascgi.thanks you.

Post by Foz »

Please read Trond's post:
Trond wrote:When you use fastcgi in C, it replaces the default printf() with a special fastcgi function.
It changes what you write. You need to get the fastcgi function and use that directly as replacing the Print() function in PureBasic automagically on compile isn't possible.
ruyi7952
User
User
Posts: 11
Joined: Thu Jan 21, 2010 5:27 pm

Re: Help. about fascgi.thanks you.

Post by ruyi7952 »

thanks foz.

where it's Trond's post???? :wink:
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Help. about fascgi.thanks you.

Post by Trond »

I want to write a stdio mode fastcgi,stdio mode needed socket too????
I think so.
Post Reply