Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Launch threading in CGI

Posted on 2006-10-20
7
269 Views
Last Modified: 2013-12-25
i have a C++ CGI program. i want the CGI (or any other way) to launch an executable program, a threading program, which calls and checks another module. the threading program would notify the cgi if the another module has input data, and pass the input data to the CGI.

since it is a threading program, i don't want the program to die even if i am navigating to other pages. i just want to receive notifications from the threading program about what is happening on the other module.

thanks very much! i am really desperate............. (it's also my first time about CGI, so please help me) :)
0
Comment
Question by:autistic
  • 4
  • 3
7 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17772536
Are you really talking about CGI used in a web server, where it is called from a browser?
Then I guess it does not make much sense to use a "threading program" (whatever this means) 'cause HTTP is a stateless protocoll. Even if the CGI contacts your threads, it needs to wait 'til it gets the response from the thread to pass it back to the browser.

Probably I misunderstood your requirement, then please explain in more detail what to want to do.
0
 

Author Comment

by:autistic
ID: 17772575
yeah, im talking about "CGI used in a web server, where it is called from a browser". or when a button is pressed..

i need the threading program, so any changes to the module that i was monitoring would be reflected to the HTML UI.

similar result of it would probably be yahoo mail (or the likes) which automatically updates the UI if new mails arrive..something like that...

if you have any other suggestions, please tell me.. its just my first time with CGI :)
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 200 total points
ID: 17774821
You server never pushes data to the client, but the client requests them from the server.
Having this in mind you need to build your page in that way the browser periodically calls the server (which breaks the basic rules and design of HTTP, but's usual anyway).

How do you plan to tweak the browser to make the request?
Could by a simple meta refresh tag, or any malicious code (lile JavaScript).
0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 

Author Comment

by:autistic
ID: 17785950
i got your point.. the thing is, before the "browser periodically calls the server", there are still two modules below the server (ex. server is checking moduleA, and moduleA is checking moduleB). if "browser periodically calls the server", does this mean that polling should also be implemented in moduleA and moduleB? how would server trigger moduleA(and moduleA trigger moduleB)?

im such a newbie in web programming, so pls help...thanks!
0
 

Author Comment

by:autistic
ID: 17787084
btw, i just asked the client, and he said that periodic calls to the server is not an option since he wants "immediate" change on the web browser (meaning refreshing even every 5 secs is not accepted), or runtime.. any more ideas? pls....

so it really is more likely that the module is prompting the web server to change the current browser display... help..
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17796485
> .. and moduleA is checking moduleB
and
> .. should also be implemented in moduleA and moduleB?
I guess you are not used to what moduleA and moduleB is doing.
To what else should moduleB talk if it is called by moduleA?

> .. is not an option since he wants "immediate" change on the web browser
tell him, that he should by a fat client client-server application *not* based on HTTP

Again: it is impossible that your server connects back to the browser (speaking about HTTP).
0
 

Author Comment

by:autistic
ID: 17872454
hey thanks... i implemented the meta refresh(calling the .cgi every refresh). i refresh every 5secs, since this is the "closest" solution available.. :)
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question