Chapter Contents


SAS/CONNECT User's Guide

Server Portion of the ADM Application

The following pseudo code is taken from the server portion of the ADM application. The server portion of this application is one main loop that both continuously receives messages with message types that have been defined to this application and performs the appropriate action based on the message type. The server portion of the application receives its messages using direct messaging and sends messages using both direct messaging and message queuing.

The majority of the logic is contained in the server portion of the ADM application. This has the benefit of being able to modify the server portion of this application (either changing or adding functionality) without having to update the user portions of this application.

   /*  Main Server Loop                      */
do while (finish='N');
   call send(station, '_query', eventtype,
      msgtype, 0, alist, cobj, rc);
   if rc eq 0 then do;
      put 'Eventtype is ' eventtype;
      if eventtype = 'DISCONNECT' then do;
         put 'Client ' cobj ' is 
            disconnecting from the server.';
   else do;
      if eventtype = 'CONNECT' then
         put 'Client ' cobj ' has connected 
            to server.';
      else do;
         put '  ----  client is ' cobj;
         put 'Msgtype is ' msgtype;
         put 'Receiving message from client';
               /*  Stop server message.      */
               /* User wants to register.    */
               /* Create qname based on      */
               /* userid.                    */
               /* User wants to de-register. */
               /* User wants to check out    */
               /* an entry; send the entry   */
               /* as an attachment.          */
               /* User wants to check in a   */
               /* catalog entry. Accept      */
               /* updated entry as an        */
               /* attachment and broadcast   */
               /* the updated entries to     */
               /* all registered users.      */
               /* User wants to add a new    */
               /* entry. Accept the new      */
               /* entry as an attachment     */
               /* and broadcast the new      */
               /* entry to all registered    */
               /* users.                     */
               /* User wants to receive new  */
               /* or updated entries; send   */
               /* entries as attachments.    */
               /* Otherwise, unknown         */
               /* message type.              */
         end;  /* select msgtype */
      end;     /* else not disconnect */
   end;        /* if rc */
end;           /* do while */

The addition of messaging and queuing to the existing SAS System client/server toolset provides an integrated solution to your most complex client/server application needs. The logical flow of information in messages that underlie the SAS direct messaging facility allows you to layer your distributed applications to best meet your business needs.

The flexibility of the indirect communication that underlies the SAS message queuing facility allows you to implement, deploy, modify, and schedule the various programs that make up your applications independently and more efficiently.

Used together, direct messaging and indirect messaging allow you to minimize the cost of implementing and running your client/server applications by allowing your data sources, hardware resources, and information goals to dictate the logic structure, the platforms, and the schedules on which to run the programs that comprise your applications.

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.