Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

Interactive programming

Hi!

I have made a C program for linux.. and everything is fine.. now, I want to make a web page (PHP or perl) that will launch the program with the correct option..

how can I do so? and more important, is there any way to communicate with my programme once it has started to let's say pause/resume/stop it without killing the process because I have to save data prior to shuting it down..

Thanks
0
nfuids
Asked:
nfuids
1 Solution
 
pankajtiwaryCommented:
Well For CGI scripting through C u can use a package called cgic. It's a very good package which will certainly help you. As far as pausing the process is concerned you have to handle it manually because I don't any tool for this purpose.
0
 
kuistCommented:
yeah, but what way do you suggest to handle the pausing of my process ?
0
 
kuistCommented:
I had the same problem

and I finally didn't make it 'pausable' but someone suggested me to make it listed to a tcp port and have another process send the information that would make the first process pause.

my process was/is multithreaded, so what the guy said was to have a flag that should be turned to pause when ever the pause comand would come in via the tcp port.

but didn't know how to implement it, so I left it the way it was :)

hope this help a little =/
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
paul8883Commented:
You can run the application from Perl script no matter what language you have used for writing the application (C, C++, ...). The problem is how the CGI writen in perl or PHP can control the external program for example writen in C. In the case both CGI and the C program are in the same machine, you have different options:

1) using signal, from the perl script CGI, send the signal to the child process (C program)

2) using the name pipe, the child process read the commands from the name pipe which the perl CGI will write.

3) using the socket, the child process listen a socket port for the command and the CGI write the command to the socket.

I would prefer to use signal cause it's quite easy to implement it. Also namepipe is not dfficult.
0
 
kuistCommented:
would you have a little example of Signal and/or name pipe?

Thanks
0
 
kuistCommented:
socket was my first thought of how to do it.. but if the other two are quite easy to implement.. I guess it could help :)


0
 
jmcgOwnerCommented:
Nothing has happened on this question in more than 9 months. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
accept answwer by paul8883 [grade B] (why is kuist asking followup questions?).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now