E. Edward Mindlin - The Server in Client/Server
Posted September 1 1997
I was rather intrigued walking into E. Edward Mindlin's presentation entitled, "The Server in Client/Server". My first impression upon hearing the title was that it would cover various SQL servers: a potentially dry topic. Instead, the session explored the implementation of a Clarion for Windows program as a Windows NT Service.
For those of you who aren't familiar with this concept, an NT Service is a program that runs on an NT server, completely in the background. It doesn't take any input from the user; all it does is "process". What it processes is completely up to you. Common uses are transaction processing, timed events, and device drivers.
There are various benefits to running as an NT Service. First is that your program utilizes fewer server resources. It is also one more step on the road to get Microsoft BackOffice certification for your application.
An NT Service app must call various Win32 API functions when it starts. This lets NT know that your program is to be called as a service, and how that can be done. From that point onward, the Service Control Manager or "SCM" (a.k.a. "scum").
He touched several times on the differences between Clarion threads and NT threads. Clarion's START() function supports the THREAD attribute on variables. NT's CreateThread() function allows the passing of a parameter. If you decide to to use CreateThread(), Ed warned that you should be careful while accessing global variables that would normally be managed with the THREAD. His suggested method was to use the API functions EnterCriticalSection() and LeaveCriticalSection(). These are roughly synonymous with Clarion's LOGOUT and COMMIT procedures, except for memory rather than files.
Once your application is installed and running as an NT service, it will be called by the SCM when appropriate. It must watch for a number of standard SCM events for pausing, resuming and stopping the service.
You're service must be added to the system Registry using CreateService() and removed using RemoveService(). All NT services are administrated in the Control Panel Applet.
He also covered debugging tips and tricks. Unfortunately, Clarion's debugger cannot attach itself to a running service. Ed's suggestion was to write information to an ASCII log file, and peruse it after exiting the application.
There was much more information that we could cover in the one hour session. This would work out much better as a half-day or full-day seminar. Regardless, we managed to learn enough to understand how Clarion can be used as a tool for NT Service development. If you want to know more, he'll be placing a sample program on Compuserve and IceTips (www.icetips.com).
Article comments
Post a comment
You must be logged on to post comments.
Talk To Us!
Search ClarionMag
From the archives
The Five Minute Developer: Displaying QUEUEs
4/28/2006 12:00:00 AM
The QUEUE is one of the Clarion language's most powerful, useful, and unique structures. In this installment of the Five Minute Developer, Dave Harms looks at some of the techniques available for displaying QUEUEs in list boxes.
