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 > 2001 > 06 > Programming with Perl  

Laughing at the News

By Randal L. Schwartz

In a recent newsgroup thread I was following, someone posted a question about creating a CGI-to-NNTP gateway. This would permit in-house staff to access an NNTP server in a limited fashion via the Web, without having to use a news client. I initially balked at the idea because every CGI hit is a separate process, requiring the script to reestablish a connection to the NNTP server. And from what I've seen, NNTP servers tend to be mighty slow on that initial handshake.

But I thought about it for awhile, and realized that if the first hit could start a Web "miniserver," then that single miniserver could keep the connection alive at very little overhead cost.

We can use the HTTP:Daemon module I wrote about in December 2000 to maintain an NNTP connection. This same technique could also be used to keep a connection alive to a database, or perhaps even a shell session. (Hmm, there's an idea for another program.)

To demonstrate how this works, I've written a script that browses the rec.humor.funny (RHF) newsgroup, and displays the joke-of-the-day posted by the RHF people. Because anyone can invoke this CGI program from anywhere in the world, but only people at my ISP can use my news server, I must ensure that I'm complying with any reuse agreements for content hosted on the news server. Caveat Executor.

Configurations and Preparations

The script in



  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