11.3. A Simple Communications Application

The easiest way to understand how the communications facilities of the 32-bit API work is to look at an extremely simple example of modem communications. While this first example does not accomplish anything particularly useful, it does demonstrate all of the steps that must be followed to create a successful connection.

Listing 11.1 contains a very simple communications program. To use it you will need a Hayes-compatible modem hooked to one of your serial communications ports. With a modem connected, Listing 11.1 sends the command "at" to the modem and receives back the modem's response, which is "ok." Any Hayes-compatible modem understands the characters "at" to be an " attention" command and responds ...

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.