Client-Server Communication in Perl CGI

Discussion in 'Perl Misc' started by sri, Nov 14, 2008.

  1. sri

    sri Guest

    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
     
    sri, Nov 14, 2008
    #1
    1. Advertising

  2. sri <> 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
     
    Sherm Pendley, Nov 14, 2008
    #2
    1. Advertising

  3. sri

    Jim Gibson Guest

    In article
    <>,
    sri <> 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
     
    Jim Gibson, Nov 14, 2008
    #3
  4. On 2008-11-14 18:09, Jim Gibson <> wrote:
    > In article
    ><>,
    > sri <> 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>
    >
     
    Peter J. Holzer, Nov 15, 2008
    #4
  5. sri

    Thrill5 Guest

    "Sherm Pendley" <> wrote in message
    news:...
    > sri <> 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.
     
    Thrill5, Nov 16, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Russ
    Replies:
    1
    Views:
    568
    =?Utf-8?B?Q2hhcmxlcyBDaGVu?=
    Nov 29, 2004
  2. Dustin
    Replies:
    2
    Views:
    1,065
    G. S. Hayes
    Aug 9, 2004
  3. Giojo
    Replies:
    2
    Views:
    139
    Bart Lateur
    Dec 13, 2004
  4. kath
    Replies:
    4
    Views:
    701
    J. Gleixner
    Apr 9, 2007
  5. Replies:
    0
    Views:
    151
Loading...

Share This Page