Develop a Windows NT Internet Service

Learn how an Internet protocol, such as Finger, can run as a Windows NT service

Millions of users access the Internet through systems running Windows or Windows NT. When you
use NT to access Internet services such as Finger, Gopher, or Archie, you ordinarily start them
individually at the command line (i.e., outside NT). Instead of starting these programs
individually, try running them as NT services so that you can access them from within NT whenever
you want.

In this article, I explain Finger (an Internet service that lets you query for
information about Internet users or sites) and an NT Finger service I developed. In a longer version
of this article, available on the Web at http://www.winntmag.com, I explain in detail how the NT
Finger service works and provide the code for it.

What Is Finger?
Finger is a daemon that lets Internet users (Finger clients) query a Finger server for
information about other Internet users or sites and returns responses to queries. With Finger, you
can find out a user's (account owner's) full name, the last time that user logged on, and which
users are currently logged on. A Finger operation can also return a plan, or finger, file--a text
file that contains detailed information about an account owner, such as the user's degree, office
hours (for a professor), resumés, or even Pretty Good Privacy (PGP) keys for digital
signatures.

How to Finger an Account
Many operating systems, including NT, provide a small application that lets you Finger for
remote users from the operating system's prompt. To use Finger with NT, from the command prompt, you
simply enter

finger accountname

to resolve a remote address and query the remote host for the specified user.

Screen 1 shows an example of using Finger with a remote UNIX host. In Screen 1, I first
accessed a remote UNIX host via Telnet. Then at the prompt, I entered finger

etoupin@csn.net

to query a Finger daemon in the csn.net domain (Colorado Supernet Internet Service
Provider--ISP) for user etoupin. The Finger client waits until it receives a response or a timeout
occurs, and displays the returned information as shown.

The NT Finger Service: How It Works
The NT Finger service is a standard, event-driven service that resides in the Service Control
Manager (SCM) database. You control this service through the SCM. This service monitors the Finger
TCP port (79) for requests and is transparent to the user of the system on which it resides.

A Finger service must have access to a database of users and user information. From this
database, the Finger service formats and submits information to remote requesting client systems.
The NT Finger service obtains this information from the Security Accounts Manager (SAM) database.

The Finger service provides a simple executable module that the SCM manages. At NT startup
time, when SCM starts the Finger service, the service creates a socket and then awaits incoming
connect requests from remote clients.

The NT Finger Service: Take It from Here
Finger is an easy protocol to implement as a service. You can take the service code, enhance it,
extend the protocol's functionality, or even create a new service to support another Internet
protocol.

Note that many other Internet protocols--such as Simple Mail Transfer Protocol (SMTP), Post
Office Protocol (POP), HTTP, and FTP--are more complex than Finger. Thus, NT services for these
protocols require you to write additional code, such as worker threads, or use the Visual C++ (VC++)
C Thread class to handle simultaneous requests and concurrent operations as the protocol requires.
The online Finger service code is a basic template that you can use for many other Internet protocol
services.

For a more detailed explanation and complete code, visit http://www.winntmag.com.