Re: how do I do FCGI_Accept() loop?

Jon Ribbens <jon+fastcgi-developers-JgzTmhv+UHffC7kMvaharFpr/1R2p/[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
Rares Marian <[email protected]> wrote:
> I know how to get it to work in perl and C. How does it work in PHP
> or Ruby or Python?
> 
> Preferably the PHP solution is what I'm looking for.
> 
> Something like while FGCI_Accept()>=0 { $count=$count+1; echo $count; }.

Don't know about PHP (I don't think it works like that - it does the
Accept stuff for you), but in Python you could use my fcgi.py module
(http://jonpy.sf.net/) and the code would be:

  count = 0

  class Handler(cgi.Handler):
    def process(self, req):
      global count
      count += 1

  fcgi.Server({fcgi.FCGI_RESPONDER: Handler}).run()

(effectively the 'Accept' loop is inside the fcgi.Server.run method)
(NB the 'count += 1' may well not be thread-safe)

___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.