Loading ...
Sorry, an error occurred while loading the content.

1881RE: [soaplite] persistent server-side state

Expand Messages
  • Keanan Smith
    Sep 30, 2002
      The problem with keeping server-side state is that HTTP requests are by
      definition stateless, if you need to maintain state, you'll have to do it
      externally, or through some 'special' means (Like the Apache:: modules) if
      your service is created via CGI, you have an entirely new copy of the
      iterpreter, (Hence no way to maintain state between invocations, without
      doing it yourself)

      To really have any kind of reasonable way to do what you want (I'm assuming
      you want a 'general' state rather than a session-dependant state, because it
      would be easy enough to tuck your session-dependant state into objects that
      get passed with each call) You'll need to keep track of it server-side, and
      it will have to be proof against race conditions (Where multiple calls hit
      the server at the same moment)

      So:

      one way to keep state is to dump it all out to a file and make sure you
      flock it (Thereby insuring only one of your services has access to it at a
      time)

      Another is to use a database (Pretty common, great for long-term flexibility
      and interactivity)

      Another is to use mod_perl and keep your 'state' somewhere safe (Like in the
      server namespace or something)

      In any case, there's no "quick and dirty" way to do what you want to simply.

      -----Original Message-----
      From: Gregory C. Harfst [mailto:gch@...]
      Sent: Saturday, September 28, 2002 4:44 PM
      To: soaplite@yahoogroups.com
      Subject: [soaplite] persistent server-side state



      Hello,

      I want to write a TCP server that
      maintains persistent state on the
      server. For example, I want to
      dispatch to a module:

      package ORNet::DBServer;

      use strict;

      my $foo = 1;

      sub inc {
      return $foo++;
      }


      1;

      So $foo should be incremented by
      1 on the server each time inc() is
      called from any client.

      This works when I use use autodispatch
      on the client. It doesn't work when
      I use OO-style on the client.

      Can somebody tell me what's going on
      here?

      Thanks,
      Greg Harfst




      To unsubscribe from this group, send an email to:
      soaplite-unsubscribe@yahoogroups.com



      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    • Show all 5 messages in this topic