Solved

Launch threading in CGI

Posted on 2006-10-20
7
260 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Ever wondered how to display how many visitors you have online. In this tutorial I will show you an easy but effective way to display the number of online visitors in WhizBase. In this article I assume you have read my previous articles and know …
This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now