11.5. A Simple Bulletin Board System

A bulletin board system normally runs all of the time, and waits for users to call. With the modem in auto-answer mode, it will automatically connect with the user, and send back the string "CONNECT" to indicate that a session has started. The bulletin board system generally asks the user to log in, and then starts processing user commands.

The code in Listing 11.2 demonstrates the basic communications code for a BBS of this type. Normally you would place code like this in a Windows 2000 service (see Chapter 12) so that it runs in the background all of the time. The program places the modem in auto-answer mode and then waits, using a ReadFile call, for a character. Once it sees the word "CONNECT" in the input, ...

Get Win32 System Services: The Heart of Windows® 98 and Windows® 2000 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.