Thread: CGI Server

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    1

    CGI Server

    Hi:
    I am using C to write a server(on Windows) that supports perl scripts.
    Currently, I am using the function "fp=popen("perl script.cgi","rb")" to run the script and then send the result back to
    to the browser. The problem of this scheme is the browser may time out if the script takes a long time to execute.
    Therefore,I would like to make the server to fork the script aynchronously so that I can add a loop in the server to test
    if the script finishes running or not,if it doesn't, then the server can send something back to the browser. Are there any
    functions in C that can fork a new process aynchronously and test the status of a process?
    I will appreciate any advises.

    Thanks

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Implement your own popen() type functionality, and limit the amount of time the child can run, killing it if necessary.
    http://faq.cprogramming.com/cgi-bin/...=1045780608#01
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Server Architecture
    By coder8137 in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-29-2008, 11:21 PM
  2. Where's the EPIPE signal?
    By marc.andrysco in forum Networking/Device Communication
    Replies: 0
    Last Post: 12-23-2006, 08:04 PM
  3. SWEBS Web Server
    By nickname_changed in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 09-22-2003, 02:46 AM
  4. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM
  5. socket question
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 07-19-2002, 01:54 PM