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 > 1999 > 07 > Java @ Work

Building a Server Switchboard

One reason that Java is so popular on the Web is security. Because applets run in the context of the browser, the browser can strictly control what the applet can and can't do. This is a benefit for users, but for developers, it's somewhat restrictive.

Of course, you can digitally sign your applets and hope that users will elect to relax security restrictions against them, but this isn't an ideal solution. The best answer is to find a way to work within the existing security structure.

For example, suppose you want to write an applet that needs to store data. You have very few choices. You can't write to a file on the client computer. However, you can open a network connection back to the server and write the file on the server. This requires a program on the server that listens for the applet and handles its requests.

Here's another problem: You can open network connections only back to your own server. This prevents a malicious applet from sending email from your machine, for example. But it poses a problem if you want two applets on different machines to communicate. A multiplayer game, for example, can't simply connect two applets together. The server has to act like a telephone switchboard, brokering data from one applet to the other.

This month, I'll show you how to build a simple server that lets two applets communicate with each other. The example applet lets two players play tic tac toe (or "naughts and crosses" for my friends in the UK) over the Web.




  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