Solved

Launch threading in CGI

Posted on 2006-10-20
7
261 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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 …
Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

863 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

28 Experts available now in Live!

Get 1:1 Help Now