Results 1 to 6 of 6

Thread: [RESOLVED] need named pipes help! working on web server, and trying to add CGI.

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2010
    Posts
    32

    [RESOLVED] need named pipes help! working on web server, and trying to add CGI.

    so, i've got this VB6 HTTP daemon i coded some months back. virtual hosting support and all. it works very well, but i recently decided to pick up where i left off and add support for CGI script execution.

    for example, lets say PHP scripts. i would be using the php-cgi.exe program. i think the proper way to do this is to (after setting environment variables) run it like:

    php-cgi.exe path\to\php\script.php <\\.\pipe\mypipe >\\.\pipe\mypipe

    where \\.\pipe\mypipe is an NT named pipe created by my server program before i shell out to the executable. it'd be used for sending the HTTP header and possibly POST data from the client browser (i.e. <) to php-cgi.exe and of course to return generated data back to my server program (with >)

    my problem is, and i've done some googling but can't find anything to quite help me do what i want to do, i'm not sure how i create the arbitrary pipe to begin with. also not sure how to read/write with it. i should be able to just use OPEN as if it were any other binary file after it's been created, right? or no?

    any help, guys? thanks! oh and this is my first post so hello!
    Last edited by miker00lz; Jan 15th, 2010 at 01:43 AM. Reason: added resolved to title

  2. #2

    Thread Starter
    Member
    Join Date
    Jan 2010
    Posts
    32

    Re: need named pipes help! working on web server, and trying to add CGI.

    TTT

    wow pushed down to page 2 already. does anybody know how to do this?

  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: need named pipes help! working on web server, and trying to add CGI.

    Actually you'd probably want your HTTP service to run the PHP CGI as a dependent process anyway, which would let your redirect its StdIO to anonymous pipes. On top of that the CGI interface requires that you set and then read numerous environment variables for each request/response cycle, in addition to writing and then reading the redirected StdIO streams.

    Are you sure you want to go to all this trouble?

  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2010
    Posts
    32

    Re: need named pipes help! working on web server, and trying to add CGI.

    Quote Originally Posted by dilettante View Post
    Actually you'd probably want your HTTP service to run the PHP CGI as a dependent process anyway, which would let your redirect its StdIO to anonymous pipes. On top of that the CGI interface requires that you set and then read numerous environment variables for each request/response cycle, in addition to writing and then reading the redirected StdIO streams.

    Are you sure you want to go to all this trouble?
    yes, i know environment vars and read/writing on the pipe is involved. i guess what i need to know then, is how do i start the CGI exec as a "dependent" process and access the pipe? access will have to be asynchronous to the pipe, rather than waiting for the process to close. thanks.

  5. #5
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: need named pipes help! working on web server, and trying to add CGI.

    Look at the sample project here:

    http://www.vbforums.com/showpost.php...9&postcount=14

    Doesn't handle the environment variables, but that can be added with some work. The example is running cmd.exe and then using that to run a program, but you can just as easily run an individual program itself, like your PHP CGI.

  6. #6

    Thread Starter
    Member
    Join Date
    Jan 2010
    Posts
    32

    Re: need named pipes help! working on web server, and trying to add CGI.

    Quote Originally Posted by dilettante View Post
    Look at the sample project here:

    http://www.vbforums.com/showpost.php...9&postcount=14

    Doesn't handle the environment variables, but that can be added with some work. The example is running cmd.exe and then using that to run a program, but you can just as easily run an individual program itself, like your PHP CGI.
    perfect, exactly what i needed! huge thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width