magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 1998 > 03 > Programming with Perl  

Stateful Conversations with Browsers, Part One

One of the interesting challenges in a connectionless protocol like the Web is maintaining a "session" or "state" information to allow multiple interactions as part of a larger "conversation".

In past columns, I've discussed doing this with external files, with mangled URLs, and with hidden information in forms. While these are good solutions, they all require each new CGI invocation to somehow come up to speed about which conversation this particular transaction is a part.

In this column, I'll use a different tactic: Instead of trying to "leap" the information from one program to another, I'll keep a process alive during an entire conversation, letting it die when the conversation is over. The information can stay in the dataspace of that process, and all we have to do is somehow keep reconnecting to it.

This may sound complicated, but it's actually very simple using the HTTP::Daemon module in the LWP library. I first used this module last year to create a Web proxy server. Here, we'll launch a mini Web-server from a CGI script. The mini Web-server will hold the state of the conversation, and the browser will talk to it instead of the main server.

Each ongoing conversation requires a separate process, so this method only works nicely with a small number of simultaneous "conversations." Next month, in part two of this column, I'll show how to do it with just one additional process.<>




  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2