Client-Server Communication in Perl CGI

S

sri

Hi Friends,

I have a requirement like this,

My client program is a browser, and the server may be run in perl, ror
or any other server side scripting. The browser has to send the
request to the server once, after that the server has to keep track of
the client and send the response frequently to the client.

One way we can achieve this with Applets. Is there any other way to
achieve this ??

Regards,
Sri Seethalakshmi.B
 
S

Sherm Pendley

sri said:
My client program is a browser

Do you mean, a web browser?
, and the server may be run in perl, ror
or any other server side scripting. The browser has to send the
request to the server once

Yes, that's how HTTP works. It's a stateless protocol, no connection is
maintained. The client sends a request, the server returns a response,
then they part company and go their separate ways until the client makes
another request.
after that the server has to keep track of
the client and send the response frequently to the client.

Rethink your design. A web server can't do that within the bounds of the
HTTP protocol, regardless of what scripting language it's using.
One way we can achieve this with Applets.

Yes, an applet could open and maintain a long-running connection, but to
do so it would have to use something other than HTTP. That means it
would have to connect to an application server that speaks something
other than HTTP - i.e. something that isn't a web server.
Is there any other way to
achieve this ??

To achieve *what*? You haven't said what you want to do, just how you
think you want to do it. What's the end goal of all this?

sherm--
 
J

Jim Gibson

sri said:
Hi Friends,

I have a requirement like this,

My client program is a browser, and the server may be run in perl, ror
or any other server side scripting. The browser has to send the
request to the server once, after that the server has to keep track of
the client and send the response frequently to the client.

One way we can achieve this with Applets. Is there any other way to
achieve this ??

Sounds like 'AJAX' to me. I am only familiar with the concept, not the
methods, so I can't say for sure. See
<http://en.wikipedia.org/wiki/Ajax_(programming)> for more info.

For vanilla HTTP, the choice is "server push" and "client pull". See,
for example <http://oreilly.com/openbook/cgi/ch06_06.html>.

For an example of client pull, see
<http://www.stonehenge.com/merlyn/LinuxMag/col39.html>
 
P

Peter J. Holzer

Sounds like 'AJAX' to me.

Nope. AJAX doesn't magically allow the server to send something to the
browser without a request. Instead some JavaScript running in the
browser sends requests to the browser. So, for in the terminology you
use below, it is some kind of "client pull".
 
T

Thrill5

Sherm Pendley said:
Do you mean, a web browser?


Yes, that's how HTTP works. It's a stateless protocol, no connection is
maintained. The client sends a request, the server returns a response,
then they part company and go their separate ways until the client makes
another request.


Rethink your design. A web server can't do that within the bounds of the
HTTP protocol, regardless of what scripting language it's using.


Yes, an applet could open and maintain a long-running connection, but to
do so it would have to use something other than HTTP. That means it
would have to connect to an application server that speaks something
other than HTTP - i.e. something that isn't a web server.


To achieve *what*? You haven't said what you want to do, just how you
think you want to do it. What's the end goal of all this?

sherm--

Your server side application needs a "Session" module. One of the
advantages of writing complex applications in ASP.Net is that session state
is automatically maintained between loads of the same page by the same user,
and a very easy mechanism exists to maintain variables across different
pages by the same user. Modules also exist to allow you to do this in Perl
CGI applications, but is a bit more tedious and complex to implement.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top