On the Web you can find software to write precision timers, to parse .INI files from UNIX, and to perform configuration management in a client/server environment. Victor points us to all this code and more.
Introduction
In the first half of this installment, I focus on some new and interesting programs and libraries with C/C++ source that are available by FTP. Next, Ill turn to the focus of this issue Client/Server Programming. Since client/server issues include a whole lot more than just source code, Ive also supplied pointers to Usenet newsgroups and management information. First, a word on the Universal Resource Language (URL) conventions.
Ill be presenting addresses in URL format wherever possible. A URL can be pasted directly into your Mosaic, Netscape, or other web browser. An "http://" URL designates the World Wide Web (WWW) and a "ftp://" is of course FTP file transfer. To access an FTP URL from a UNIX shell prompt, simply strip off the "://". For example,
ftp://abc.def.com/pub/user/myfile.zipbecomes the equivalent:
ftp abc.def.com cd/pub/user getmyfile.zipAs in my previous installment, I may break an excessively long address into multiple lines, so as to fit them to the columns of the magazine. When I break an address, I signify continuation by printing a single backslash (\) at the end of each line (just like in C or C++).
= Documentation
= Source code
= Links
Pointer to "A Pointer Tutorial"
PTRTUT v0.1, by Ted Jensen <tjensen@netcom.com>, is a text tutorial on pointers and arrays as they are used in the C programming language. This tutorial is aimed at newcomers to C, who often have problems understanding pointers. It includes material on structures, strings, multi-dimensional arrays, dynamic memory allocation of any of these, and function pointers. PTRTUT contains tested source code as examples. Everything in the text and examples comply with ANSI Standard C. PTRTUT is available on the SimTel server and its mirrors (see Fig. 1):
ftp://ftp.coast.net/SimTel/msdos/c/ptrtut01.zip
Read the Web Offline with NULLSOCK
Netscape, Mosaic, and other web browsers are great for reading hypertext documents. However, they require that you maintain a continuous Internet connection even when youre reading documents local to your hard drive. If you have a dial-up Internet connection, its both expensive and time consuming to dial-up just to read a document you already have. NULLSOCK, by Jean-Michel Mercier <100101.1152@CompuServe.com> includes C source code for a program that can fool any WINSOCK.DLL driver into thinking that an Internet connection is in place. The source code is written for use with Borland Turbo C. Though NULLSOCK doesnt include the WINSOCK.DLL driver itself, it does supply instructions on how to get one if you dont already have one. NULLSOCK is available on the SimTel server and its mirrors:
ftp://ftp.coast.net/SimTel/win3/winsock/nulsck10.zip
PASSWORD.SYS Gives Boot-up Protection
PASSWORD.SYS, by Joe Gruessing <gruess@gruess.ip.portal.com>, is a freeware program providing boot-up password protection for PCs. PASSWORD.SYS loads as a device driver in CONFIG.SYS and requires the user to enter the correct password to continue the boot process. Failure to enter the correct password after a predefined number of tries results in a cold reboot. A timeout counter requires entering the password in a given time period or else the system will be rebooted. PASSWORD.SYS is designed to work in conjunction with the multiple config capabilities of MS-DOS 6.xx, or DataLight ROM-DOS 6.22. Passwords are not case-sensitive in this program. The source code provided works with Borland C and Turbo Assembler, though it may work with other environments too. PASSWORD.SYS is available on the SimTel server and its mirrors:
ftp://ftp.coast.net/SimTel/msdos/security/passw203.zip
Millisecond Resolution Timer for PC
PCTIMER v1.3, by Chih-Hao Tsai <c-tsai4@uiuc.edu> is a freeware library of millisecond resolution timing routines written in C. As you may recall, the IBM PC architecture specifies a built-in timer which "ticks" 18.2 times/second. This tick rate provides a resolution of 1/18.2 = 55 milliseconds. You can use PCTIMER for programs requiring millisecond (or higher) timing resolution.
PCTIMER provides two different timing routines. One is based on System Timer Interrupt IRQ0 (int 8h), and another is based on CMOS Real-Time Clock Interrupt IRQ8 (int 70h). Though these two timing routines are completely different, they are both are good for millisecond resolution timing.
PCTIMER supports both the DJGPP C++Compiler (D.J. Delories GNU G++ system) and Borland Turbo C. (Send e-mail to djgpp-request@sun.soe.clarkson.edu for information on how to get DJGPP.) Former versions of PCTIMER supported Microsoft C, but Chih-Hao Tsai no longer tests for MSC compatability. PCTIMER remains portable since it is written entirely in C and uses no assembly language.
Although PCTIMER alters the parameters of the Intel 8254 Programmable Interrupt Timer, it remains stable by emulating the regular 18.2 times/second interrupt service routines. Additionally, the IRQ0 model timer can provide less (1/100th sec) or more (1/10,000th sec) resolution depending on your requirements. PCTIMER is available on the SimTel server and its mirrors:
ftp://ftp.coast.net/SimTel/msdos/c/pctime13.zip
CFGOPTS Reads and Writes .INI Files
CFGOPTS, by Jeffry J. Brickley, provides a small library with C source for reading and writing .INI files. MS-Windows has popularized the .INI file for configuration information. The structure of an .INI file is deceptively simple: sections are delimited by square backets (e.g. "[Ports]") and each section contains one or more tokens delimited with "=" (e.g. "COM1=IRQ4").
Although MS-Windows provides the poorly named GetPrivateProfileString() API to read these files, that doesnt help with MS-DOS drivers or installation programs that have to read or write these same files. CFGOPTS makes a nice replacement. Furthermore, you can use CFGOPTS in UNIX implementations of your program. Last, it should be noted that CFGOPTS provides automatic data conversion from various radix types (hex, decimal, octal, etc.) as well. You can get CFGOPT from the SimTel server and its mirrors:
ftp://ftp.coast.net/SimTel/msdos/c/cfgop110.zipFocus on Client/Server
The client/server model, as popularized in the late 1980s, describes a relationship between two processes. A client is a process which requests an action from a server. A server is a process which accepts requests from one or more clients and returns information. In the networked environment, clients and servers may reside on different machines. Commonly, a given machine will run both client and server processes of differing types. In the last two years, Client/Server has become almost completely identified with SQL-based systems by the trade press. In this segment, look at a variety of Client/Server programming systems.
C/S Interface to Mosaic
Internet applications are based on a client/server architecture by their very nature. Mosaic provides a new and experimental client/server API for the "NCSA Mosaic Common Client Interface" (CCI) http://www.ncsa.uiuc.edu/SDG/Software/XMosaic/CCI/ \
cci-api.html. As you may remember, Mosaic is the granddaddy of all WWW browsers. Although the CCI specification and API will very likely change in the near future, you can track its progress and download the latest version from this site. The purpose of this specification is to standardize the methods by which external programs can make contact with a running Mosaic session in the X-Windows environment. In this case the Mosaic client itself becomes a server to other applications. You might use this to implement some kind of web crawler or other automated Internet utility.
C/S-Based Software Configuration Management
P3 Software (http://www.p3.com/p3.html) produces P3, the fast software configuration management (SCM) system. SCM is all about keeping control of large projects involving multiple releases and branches thereof. If youve ever tried to do this using a bare Revision Control System (RCS), you know that comprehensive tracking requires automated assistance. You can download your own copy of P3 from this page, which is free for noncommerical users. P3 currently supports UNIX, Windows NT, and Windows clients.
P3 provides all the features of leading-edge SCM, geared for high performance. From initial deployment through to active use and administration, P3 works quickly. Built upon a true client/server architecture that doesnt rely on network file access, every piece of P3 is engineered for speed. More importantly, P3 stores and presents information about the users workspace in ways that streamline the user interface. P3s speed is not at the expense of its function. With atomic change transactions, flexible client views, and a powerful branching model, the P3 system provides a comprehensive SCM environment.
P3 does not impose any particular engineering process. You can use its mechanism to implement a wide spectrum of source management policies or no policies. P3 does not require special file system support or extensive administration. It doesnt impose its own build system either. Best of all, P3 uses a fast implementation of RCS for the repository, so your source code is never hostage to a proprietary format.
C/S Demonstration Programs
The "Client/Server Bonanza" page (http://marlin.ece.utexas.edu:2020/client_server.html), maintained by a student at University of Texas provides source code in C, C++, and PERL. These demonstration programs emphasize UNIX sockets using the TCP and UDP protocols. You can download all of them directly from this home page.
C/S Remote Procedure Calls (RPC) Tool
The German Research Network (DFN) has developed the DFN-RPC, a Remote Procedure Call Tool, to distribute and parallelize scientific application programs between workstations and a compute server or a cluster. DFN-RPCs interface is optimized for applications written in FORTRAN, but it can also be used in a C environment. You can download the tool and all documentation directly from the web (http://info2.rus.uni-stuttgart.de:81/rus/dfn_rpc/ \
README_dfnrpc.html). Youll need 20 MB free disk space to install the entire package.
In the RPC model, a client process makes requests of a server by a simulated procedure call. An RPC compiler provides the mechanism for passing the parameters over the network between the client and server. The idea of RPC is to make the division between client and server as transparent as possible to the application programmer.
The latest version, of DFN-RPC, 1.0.60 (beta), has undergone considerable improvements. Some highlights are as follows:
- Synchronous, asynchronous, and parallel RPCs
- Datapipes for message passing
- Central waiting point for the finish of a parallel RPC
- Quick-start routines to build a network of parallel application processes
- Graphical monitor (uses TCP/IP)
- Remote file access library
- Many examples
- Routines for establishing a freely configurable interconnection network between all server processes
If you want to be informed about new releases, etc., you can subscribe to a mailing list by e-mailing to
dfnrpc-l-request@rus.uni-stuttgart.de
C/S Usenet News Resources
Usenet provides several newsgroups of interest to client/server developers, including the following:
- comp.client-server
- comp.protocols.tcp-ip
- comp.protocols.tcp-ip.ibmpc
- comp.protocols.tcp-ip.domains
- comp.os.os2.networking.tcp-ip
- comp.os.ms-windows.networking.tcp-ip
- bit.listserv.ibmtcp-l
Of these newsgroups, comp.client-server is likely to contain the most interesting information for mainstream applications. A recent scan of news headers included job postings, information about ODBC drivers, questions from newbies, and the predictable debate on which development environment is "the greatest." Of course, you should first read the FAQ (http://www.cis.ohio-state.edu/hypertext/faq/usenet/client-server-faq/faq.html). If your interest is purely centered on SQL Client/Server, there are newsgroups for specific vendors such as INFORMIX (e.g. comp.databases.informix).
C/S Management Information Resources
Although there are many fascinating technologies to explore in the world of Client/Server, you must remember to consider the management aspects of organizing and maintaining the project. The "Client/Server Management HandiGuide" by Positive Support Review, Inc. is a book describing the policies and procedures required to make a successful transition for a mission-critical Client/Server project. The guide emphasizes making an efficient operation while respecting security and disaster recovery needs. You can preview parts of this book on the Internet (http://www.psrinc.com/clisrv.htm).
The "Client/Server Exchange" (http://dcewww.citi.umich.edu:8080/cse.html) is a joint venture between the University of Michigan and IBM. This center is staffed by researchers at the Center for Information Technology Integration (CITI). Their purpose is to provide guidance in development, evaluate tools, supply a testbed environment, and assist in developing proof-of-concept implementations. The current focus of the Client/Server Exchange is the Distributed Computing Environment (DCE) from the Open Software Foundation (OSF). CITI is an OSF business partner, offering the OSF DCE courses and providing customized briefings for companies interested in learning more about client/server computing. Their current DCE projects focus on issues of security, location transparency of data, and synchronization. To find out how you can take advantage of the "Client/Server Exchange" contact Bob Riddle <bdr@umich.edu>.
The "Client/Server Coffeehouse" (http://dgoats.onr.com/clients.html) claims to be the first Internet home page dedicated to discussing the real issues of implementing Client/Server in your organization. The page is run by Randy Lagel <dgoats@onr.com> and is in many ways an unabashed plug for his book Client Server The 10% You Need to Know. However, the page does include a web-based bulletin board where you can read questions and answers submitted by other coffeehouse denizens or post your own. Anyone posting to the bulletin board will receive a free copy of Lagels "55 Rules of Thumb" for implementing Client/Server solutions.
For more management information resources on Client/Server, check the "Client/Server Resources" page (http://www.athos.com/client_server.html).
Victor R. Volkman received a BS in Computer Science from Michigan Technological University. He has been a frequent contributor to the C/C++ Users Journal since 1987. He is the author of the book Windows Programming with Shareware Tools. He can be reached at the HAL 9000 BBS (313)663-4173, URL http://www.HAL9K.com/, or email to sysop@hal9k.com.