1

我使用 linux 示例编写了一个玩具 fastcgi 应用程序。我现在想在 Windows 上运行它。我该怎么做?我知道如何在 linux 上生成进程并通过 nginx(或 lighttp)连接到它。我不知道如何在寡妇身上产生这个过程。我使用 pthreads 和 fastcgi lib 构建应用程序。产卵是我的下一步。我用谷歌搜索没有运气。我想通过 Windows 上的 nginx 连接。

如何在 Windows 上生成我的 fastcgi 应用程序?(我在 Windows 7 上)

4

2 回答 2

1

我找到了解决方案。我放了一个 ifdef WIN32 并添加了这一行FCGX_OpenSocket(":1234", 10);1234 是端口,10 是监听功能的积压。

于 2012-02-10T05:46:54.157 回答
0

很好的例子对我有用(Windows CodeBlocks GCC 编译器):

#include <fcgiapp.h>

int main()
{
    int sockfd = FCGX_OpenSocket("/var/run/myfcgiserver.sock", 1024);
    FCGX_Request request;

    FCGX_Init();
    FCGX_InitRequest(&request, sockfd, 0);

    while (FCGX_Accept_r(&request) == 0)
    {
        FCGX_FPrintF(request.out, "Content-type: text/html\r\n"
        "\r\n")
        "<h1>Hello World!</h1>");
        FCGX_Finish_r(&request);
    }
}

来自: http: //forum.nginx.org/read.php?2,1399,1439 ,quote=1

于 2012-08-10T10:58:07.347 回答