A form of IPC

This is a discussion on A form of IPC within the Windows Programming forums, part of the Platform Specific Boards category; I have a server program that runs as an NT service. I need a way for it to open an ...

  1. #1
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986

    A form of IPC

    I have a server program that runs as an NT service. I need a way for it to open an application and give it some data (possibly with command line arguments), and a way for the program to communicate information back to the server and vis-versa.

    Could anyone tell me what I should look up to allow communication like this? Keep in mind the server will start multiple instances of this program, and I'd rather the program was a main() program rather than a winmain().

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    Your server can use CreateProcess() to create the subordinate processes, if necessary, with command line arguments. This...

    >>> I'd rather the program was a main() program rather than a winmain().

    ... is your biggest problem. If you don't have imediate access to the Windows loop in the subordinate tasks, (you can get at it, but it's fiddly), so a lot of the sophisticated inter-process communication techniques become difficult/impossible to use. You may well be able to fiddle your apps to use a pipe ir mailslot, but without more information, it's difficult to comment.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    Ok, my server cannot create pipes on its own, so I must call a program that creates the pipes and handles all the output.

    The server is a web server, and the application it calls has to handle requests for CGI files.

    All it has to hand the CGI handler is info about the file, CGI environment variables, and the socket descriptor. This could all be done from arguments when the programs called.

    All the CGI handler must do is return true/false, depending on if it succeeded or failed. It also sends information out using the socket descriptor it was given. The server just needs to call it and catch a return value, thats about all. In fact I dont think theres much need for any real IPC.

    What functions could I use to create a program and get its return value?

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    Use CreateProcess() to create you subprocess, (can use command line arguments), and GetExitCodeProcess() to find out what it exited with.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Calling datas from another form?
    By Aga^^ in forum C# Programming
    Replies: 2
    Last Post: 02-06-2009, 01:17 AM
  2. Segmentation fault - IPC
    By kbfirebreather in forum C Programming
    Replies: 7
    Last Post: 02-01-2009, 02:17 PM
  3. Accessing main form from functions in other classes
    By pj_martins in forum C++ Programming
    Replies: 1
    Last Post: 11-05-2004, 08:27 AM
  4. My UserControls dissapear off my form
    By zMan in forum C# Programming
    Replies: 2
    Last Post: 09-15-2004, 08:55 AM
  5. Making an MFC form to suit
    By TJJ in forum Windows Programming
    Replies: 1
    Last Post: 04-17-2004, 11:20 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21