Re: Hello and a Threading/External Server/Win32 question
Jay Sprenkle <[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
I looked into lighttpd's source. The author detests windows and refuses to port to it. On Thu, Apr 16, 2009 at 4:36 PM, Shane Calimlim <[email protected]>wrote: > I was considering looking into some web server source, I know Apache > maintains a thread pool for responding to a single port, and I'm pretty sure > lighttpd does too (lighttpd's source is a lot smaller, so it would probably > be easier to locate what they are doing). > > If I find an answer I will definitely let you know; please let me know if > you do too! > > > On Thu, Apr 16, 2009 at 2:28 PM, Jay Sprenkle <[email protected]> wrote: > >> I looked at this too and found the answer in cygwin. They duplicate a lot >> of the functionality of unix and have already been down this path. Here's >> the clue I found: >> http://www.mail-archive.com/[email protected]/msg62458.html >> >> I may be wrong but the short answer seems to be you can't pass open file >> handles that are tcp connections between processes because windows doesn't >> treat everything (tcp connections) as a file. I've not seen any way to get >> fastcgi to work on windows as the official specs specify (since you must >> pass more than a file handle between processes). >> >> If you get it to work I'd love to see how. >> >> If you use a named pipe on the other hand things get easier, and named >> pipes are supposed to be faster than tcp connections too. >> >> >> >> >> On Thu, Apr 16, 2009 at 3:59 PM, Shane Calimlim <[email protected] >> > wrote: >> >>> Hi, first let me say that I'm new to the list, but I've been using (and >>> loving) FastCGI for years -- great work everyone involved. >>> >>> I'm working on a FastCGI external server (using a port) with multiple >>> threads. The problem I'm having is that even with multiple threads, only >>> one request is being handled at a time. Multiple threads are handling them, >>> but FCGX_Accept_r() is locking until the previous request's FCGX_Finish_r() >>> is called. >>> >>> I am also using the Qt framework; in the code snippets below qDebug() is >>> just a debugging printf(). >>> >>> Here is the code I'm using: >>> >>> In main(): >>> >>> if( FCGX_Init() != 0 ) >>> { >>> qDebug( "FCGX_Init() error." ); >>> ::exit( 1 ); >>> } >>> g_listenSocket = FCGX_OpenSocket( ":9000", 100 ); >>> if( g_listenSocket < 0 ) >>> { >>> qDebug( "FCGX_OpenSocket() error." ); >>> ::exit( 1 ); >>> } >>> >>> //spawn threads and wait until they all terminate >>> >>> In each thread: >>> >>> FCGX_Request request; >>> if( FCGX_InitRequest( &request, g_listenSocket, 0 ) != 0 ) >>> { >>> qDebug( "FCGX_InitRequest() error." ); >>> ::exit( 1 ); >>> } >>> >>> int status; >>> for(;;) >>> { >>> status = FCGX_Accept_r( &request ); >>> if( status != 0 ) >>> { >>> qDebug( "FCGX_Accept_r() error." ); >>> ::exit( 1 ); >>> } >>> >>> FCGX_FPrintF( request.out, "Content-Type: text/plain\r\n\r\n" ); >>> FCGX_FPrintF( request.out, "Hello World!\n" ); >>> for( int i = 1; i <= 10; ++i ) >>> { >>> msleep( 1000 ); // this is a Qt function -- a 1 second sleep >>> FCGX_FPrintF( request.out, "%d\n", i ); >>> FCGX_FFlush( request.out ); >>> } >>> FCGX_Finish_r( &request ); >>> } >>> >>> I've tried various combinations with Init/OpenSocket being in each >>> thread, but have had no luck with those. I've also tried WSADuplicateSocket >>> on g_listenSocket, but Windows complains that it is not a socket. >>> >>> Is this possible at all? Is it possible on Windows? The target platform >>> is Linux, but I develop on Windows, so having it work identically on my dev >>> machines would be very useful. >>> >>> >>> _______________________________________________ >>> FastCGI-developers mailing list >>> FastCGI-developers-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org >>> http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers >>> >>> >> >> >> -- >> -- >> The PixAddixImage Collector suite: >> http://groups-beta.google.com/group/pixaddix >> >> SqliteImporter and SqliteReplicator: Command line utilities for Sqlite >> http://www.reddawn.net/~jsprenkl/Sqlite<http://www.reddawn.net/%7Ejsprenkl/Sqlite> >> >> Cthulhu Bucks! >> http://www.cthulhubucks.com >> > > -- -- The PixAddixImage Collector suite: http://groups-beta.google.com/group/pixaddix SqliteImporter and SqliteReplicator: Command line utilities for Sqlite http://www.reddawn.net/~jsprenkl/Sqlite Cthulhu Bucks! http://www.cthulhubucks.com _______________________________________________ FastCGI-developers mailing list FastCGI-developers-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org http://mailman.pins.net/mailman/listinfo.cgi/fastcgi-developers