Got Objects in Sessions working, but Handles are not maintained.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jon Grieve

    Got Objects in Sessions working, but Handles are not maintained.

    Hi,

    I've been playing for a few days now with putting Objects in sessions
    and maintaining that object during a session. This seems to be working
    just fine, and I can see and use most of the functionality without a hitch.

    In my particular case, I have a Class that performs various TCP/IP
    functions. Basically, it connects to a device using telnet and
    interacts with that device. I open the connection and login as part of
    my class, and I want to keep that connection established so that the
    various pages can issue a command without having to re-connect and
    re-login each time.

    So, for example, I do a socket_connect( ) early on and want to maintain
    that connection while the class is passed from page to page. However,
    after the first use of the socket and subsequent redirect to another
    page, I find I have a valid class with all its properties intact, but
    the socket handle (a property itself) seems to have become invalid.

    Make any sense? Anyone got any clues?

    Thanks,
    Jon
  • Pedro Graca

    #2
    Re: Got Objects in Sessions working, but Handles are not maintained.

    Jon Grieve wrote:[color=blue]
    > ... However,
    > after the first use of the socket and subsequent redirect to another
    > page, I find I have a valid class with all its properties intact, but
    > the socket handle (a property itself) seems to have become invalid.
    >
    > Make any sense? Anyone got any clues?[/color]

    I guess you can't do that.
    A socket is a /resource/ and resources cannot be serialized, therefore
    they can't be saved in session variables (unless there's another way to
    save them other than serializing ... ?)

    It seems you're stuck with opening and closing the connection for every
    access. Somebody please tell us I'm wrong :)
    --
    --= my mail box only accepts =--
    --= Content-Type: text/plain =--
    --= Size below 10001 bytes =--

    Comment

    Working...