Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Client-Server Communication in Perl CGI

Reply
Thread Tools

Client-Server Communication in Perl CGI

 
 
sri
Guest
Posts: n/a
 
      11-14-2008
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
 
Reply With Quote
 
 
 
 
Sherm Pendley
Guest
Posts: n/a
 
      11-14-2008
sri <(E-Mail Removed)> writes:

> 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--

--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net
 
Reply With Quote
 
 
 
 
Jim Gibson
Guest
Posts: n/a
 
      11-14-2008
In article
<(E-Mail Removed)>,
sri <(E-Mail Removed)> wrote:

> 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>

--
Jim Gibson
 
Reply With Quote
 
Peter J. Holzer
Guest
Posts: n/a
 
      11-15-2008
On 2008-11-14 18:09, Jim Gibson <(E-Mail Removed)> wrote:
> In article
><(E-Mail Removed)>,
> sri <(E-Mail Removed)> wrote:
>> 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.


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".


> 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>
>

 
Reply With Quote
 
Thrill5
Guest
Posts: n/a
 
      11-16-2008

"Sherm Pendley" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> sri <(E-Mail Removed)> writes:
>
>> 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--
>
> --
> My blog: http://shermspace.blogspot.com
> Cocoa programming in Perl: http://camelbones.sourceforge.net


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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Recommendation for a small web framework like Perl's CGI::Applicationto run as CGI? excord80 Python 17 01-29-2009 06:02 PM
what's wrong calling a Perl/CGI script in Perl/CGI script under Tomcat server? kath Perl Misc 4 04-09-2007 09:21 PM
Python-cgi or Perl-cgi script doubt praba kar Python 1 07-30-2005 08:25 AM
Communication between Cgi and another perl application Giojo Perl Misc 2 12-13-2004 02:08 PM
Re: CGI Perl "use CGI" statement fail Jürgen Exner Perl 0 07-31-2003 02:00 PM



Advertisments