BeNews LogoBeNews
HomeHome ForumsForums ArticlesArticles LinksLinks Media CenterMedia Center StoreStore ContactContact
BeOS Free Download
BeOS In Focus

Multiuser Internet Programming with MUSCLE

BeOS in Focus this week features the powerful MUSCLE API

By Eugenia Loli - Sunday, July 23rd at 3:37pm


One of the more exciting capabilities of the Internet is its ability to bring groups of geographically separated people together into a shared virtual environment. Whether it's an IRC chat room, a role playing MUD, a Quake 3 multiplayer death match or even SETI, the Internet can form the "glue" that binds many computers (and their users) together and allows them to interact, affecting each other's actions as if they were together in a real place. Furthermore, a system that can dynamically assemble groups of computers together is useful in other ways as well--witness the recent rise of programs such as Napster and Gnutella, which are really just fancy matchmaking programs connecting one user's machine (the one who wants a file) with another (the one who has that file). Jeremy Friesner will guide you through the wonders of MUSCLE, a powerful toolkit that it will allow you to create such applications with ease.

Creating a multiuser program like those mentioned above can be a daunting task, however. Somehow you've got to provide a way for every client computer to talk to every other client computer, and also a way for them to share and exchange data efficiently. More than that, you need a way of synchronizing your clients, so that they all present coherent information to their users. (For example, if your computer shows that you've incinerated Player X with the rocket launcher, and Player X's computer shows that you missed, there's going to be trouble!)

On the BeOS, we programmers have the same basic networking tools as anyone else: a TCP/IP stack based on the BSD "sockets" API. You can write multiuser programs directly on top of this, and many people have; but as I mentioned above, it's a lot of work. Fortunately, there is an easier way to do it. The MUSCLE toolkit, by Level Control Systems, can be employed to do the grunt work for you, leaving you more time to handle the interesting aspects of your app. MUSCLE is an open source, high level networking toolkit that implements real-time data sharing between dozens of client machines.

This article will give you a high-level view of how MUSCLE operates, and also guide you through a brief tutorial on how to write a multiuser-aware client program using MUSCLE's APIs.

As an added bonus, the example code for this article comes in the form of a fully functional MUSCLE-based file sharing program called BeShare (Download BeShare in order to understand the article better). If you've ever used Napster or HotLine, then the purpose of BeShare should be apparent to you: You can use it to swap files with your fellow BeOS users. But since BeShare is a BeOS program, and BeOS programs are required by law to kick ass, BeShare also includes a few features that Napster and friends don't have--namely, with BeShare your queries are "live", (i.e. the results displayed on client track the server's database in real time); and BeShare leverages BeOS's database-like filesystem by allowing you to see a shared file's attributes before you download it. So you non-programmer types may want to stop here and get an idea of MUSCLE's capabilities by downloading BeShare, whereas the more technically inclined can read on to learn how it all works.

Thanks to Ben Raymond and Benton REA's PowerNET ( for hosting the MUSCLE server machine used with this demo!

BeShare client

Page Index
1: Background
2: Review of MUSCLE services
3: Server side database
4: BeShare
5: Sending and receiving messages with the MessageTransceiverThread
6: Executing a Query
7: Sending chat messages
8: Peer-to-Peer file transfers
9: Hanging up

[ Discuss this article ]

Other stories with topic 'BeOS In Focus' Email Story
BeOS Article on IBM DeveloperWorks
3iVX BeOS Encoder Review
Review: YMF-754 Sound Card & BeOS Driver
Exclusive Preview: Space Tripper


Copyright © 1998-2001 by BeNews.
BeNews and the BeNews logo are trademarks of BeNews.
Reproduction of stories by BeNews Corp. is granted only if credit is given to
The My Netscape icon and associated icons are property of the Netscape Communications Corporation. Some of the icons used herein are the property of Be, Inc. and are used by permission. All other trademarks, icons, and logos, shown or mentioned, are the property of their respective owners.

Powered by Geektek Hardware
Submit Story

Write an Article
BeOS Box Icon
BeOS Radio
Listen to BeOS RadioMP3 Audio Stream

Software Updates
By BeBits
FlipSide A.E. 1.0.6
Army Knife 3.1.3
DeeperPeople 3.0dr3
CDDBLookup 2.0beta
BeTweak 1.0.0
oggenc 0.7
Playlister 1.0
GL_sp 1.0
LocaleTracker Language Files 1.2.9
G400 driver 0.11
BeSwcSend 0.70 beta
FourWays 0.1b
BNews 0.9d ("Possessed.") Final FIX B
BlueCult 0.1
Windows Theme for BeOS 0.9

Software of the Week
By Eugenia Loli-Queru
BeWare SpLocale / Siegfried Locale
Yup, two Localization libraries at once this week in our column.
Siegfried Locale allows developers to add multi-language support to their BeOS applications. The package includes a library (incl. SDK) and an editor.
SpLocale offers a tool to manage the languages preference list and a simple but very powerful localization editor. Moreover, adapting an existing application to SpLocale is just a matter of hours, if not only minutes, depending of the complexity of the application.
Post Comment

Tip of the Day
From the BeOS Tip Server
Connecting to Ricochet wireless networks

BeNews Button
About Linking to BeNews

BeNews Privacy Statement