home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 11 / 11.iso / n / n001 / 2.ddi / EXAMPLES / NONPER / README
Encoding:
Text File  |  1989-12-11  |  7.4 KB  |  236 lines

  1.                        nonper Example
  2.  
  3.  
  4.  
  5.  
  6. 1.  Environment
  7.  
  8. This example is designed to be built and executed on a PC
  9. that runs DOS, the Microsoft C Compiler and utilities, and
  10. that uses the NetWare network library.
  11.  
  12.  
  13.  
  14.  
  15. 2.  Overview
  16.  
  17. This example shows a client program that uses the non-
  18. persistent process-binding technique. With this type of
  19. process binding, the client remote opens a process binding
  20. with the server for each remote procedure call and closes
  21. this binding upon completion of that call.
  22.  
  23.  
  24.  
  25.  
  26. 3.  Keywords
  27.  
  28. non-persistent process binding, shut_down global variable
  29.  
  30.  
  31.  
  32.  
  33. 4.  Files
  34.  
  35. Source files for this example reside in the following sub-
  36. directories:
  37.  
  38. server:
  39.  
  40.      Contains code and build procedures for the server part
  41.      of this distributed application.  The server consists
  42.      of the server control procedure, which is provided with
  43.      the product distribution, the dispatcher procedure and
  44.      server stub routines, which are generated by the RPC
  45.      Compiler, and the remote procedures, which are provided
  46.      with this example.
  47.  
  48.      rproc.c       remote procedure application code
  49.  
  50.      server.mk     makefile for building the server
  51.  
  52.      serv_def.h    include file with macro definitions for
  53.                    the server control procedure
  54.  
  55. client:
  56.  
  57.      Contains code and build procedures for the client part
  58.      of this distributed application.  The client consists
  59.      of the client main program and any associated routines,
  60.      which are provided with this example, and the client
  61.      stubs, which are generated by the RPC compiler.
  62.  
  63.      client.c      client application code (main program)
  64.  
  65.      client.mk     makefile for building the client
  66.  
  67. common:
  68.  
  69.      Contains the RPC interface specification used by the
  70.      RPC compiler to create the client and server stubs.
  71.  
  72.      nonper.rpc    RPC interface specification for this
  73.                    example
  74.  
  75.  
  76.  
  77.  
  78. 5.  Network Configuration
  79.  
  80. Before you can run this example, you may have to ask your
  81. system administrator to configure your system specifically
  82. for your needs.  The required configuration is described in
  83. the file: ..\..\READSPX
  84.  
  85.  
  86.  
  87.  
  88. 6.  Server Name
  89.  
  90. As distributed, the server for this example will register
  91. under the name "example".  However, it is strongly suggested
  92. that a unique server name be assigned to this example before
  93. it is built.
  94.  
  95. A unique server name will prevent two or more users from
  96. invoking a server process using the same server name.
  97. Choose a server name not likely to be selected by someone
  98. else.  For example, use your user or login name.
  99.  
  100. The server name must be changed in both the client and the
  101. server, and the SAME name must be used.  To change the
  102. server name for the client program, change to the client
  103. directory (client) and edit the file client.c.  Change the
  104. #define Server_Name statement as follows:
  105.  
  106.       #define Server_Name "example"
  107.           is changed to
  108.       #define Server_Name "myname"
  109.  
  110. To change the server name for the server program, change to
  111. the server directory (server) and edit the file serv_def.h,
  112. which contains the define statements for the server control
  113. procedure.  As with the client program, simply change the
  114. #define Server_Name statement.
  115.  
  116.  
  117.  
  118.  
  119. 7.  Building Client & Server
  120.  
  121. Procedures are included for building the example program.
  122. These procedures assume that your environment is set up as
  123. follows:
  124.  
  125.    - The PATH environment variable must specify the location
  126.      of the RPC Compiler executable files.
  127.  
  128.    - The LIB environment variable must specify the location
  129.      of the RPC runtime libraries.
  130.  
  131.    - The INCLUDE environment variable must specify the
  132.      location of the RPC .h include files.
  133.  
  134.    - The PDUDIR environment variable must specify the
  135.      location of the RPC .rpc files.
  136.  
  137.    - The RPCSCP environment variable must specify the
  138.      location of the RPC server control procedures.
  139.  
  140. The PATH, LIB, and INCLUDE environment variables should be
  141. set in your autoexec.bat file by modifying their current
  142. definitions. The PDUDIR and RPCSCP environment variables can
  143. be set in your autoexec.bat file, or in a local .bat file,
  144. or directly with the "set" command.
  145.  
  146. Since a distributed application runs on two machines, you
  147. must install an executable version of the client or server
  148. on another machine.  If the two machines are identical, you
  149. can build both executables (the client and server) on one
  150. machine and then move one of the executables.  However, if
  151. the two machines are not identical, you must follow the
  152. directions on the other machine for running this example and
  153. build one of the executable programs there (note that the
  154. executable filenames may differ across products).
  155.  
  156. Note that with the Microsoft C Compiler and utilities,
  157. numerous warnings will be generated when executing the
  158. makefiles. For example, you may see a "target does not
  159. exist" or "module not in library" warning. These simply mean
  160. that the file the makefile is currently creating does not
  161. yet exist. Generally, all warnings may be ignored.
  162.  
  163. To build the example program, you simply execute the build
  164. procedures in each subdirectory as follows:
  165.  
  166.   1.  Change to the client directory (client) and build the
  167.       client:
  168.  
  169.            make client.mk
  170.  
  171.   2.  Change to the server directory (server) and build the
  172.       server:
  173.  
  174.            make server.mk
  175.  
  176.  
  177.  
  178.  
  179.  
  180. 8.  Running the Distributed Application
  181.  
  182. The server program should be started before the client
  183. program is run.
  184.  
  185. To run the example on two machines, proceed as follows:
  186.  
  187.   1.  Change to the server directory (server) on the machine
  188.       running the server and start the server:
  189.  
  190.            server
  191.  
  192.   2.  Change to the client directory (client) on the machine
  193.       running the client and start the client:
  194.  
  195.            client
  196.  
  197.  
  198.  
  199.  
  200.  
  201. 9.  Description
  202.  
  203. This example shows a client program that uses the non-
  204. persistent process-binding technique. With this type of
  205. process binding, the client opens a process binding with the
  206. server and closes this binding upon completion of that call.
  207.  
  208. You should consider using non-persistent process bindings in
  209. cases where the overhead of binding establishment does not
  210. impact the design of your distributed application.
  211. Typically, this occurs when your client application calls
  212. remote procedures infrequently and is not closely coupled to
  213. the server application.
  214.  
  215. One of the primary advantages of using non-persistent
  216. bindings is that neither the client nor the server has the
  217. overhead of maintaining the binding.  This can be especially
  218. important if your server application must support a large
  219. number of client applications.  For example, the number of
  220. open file descriptors is often limited by the operating
  221. system.  By using non-persistent process bindings, the
  222. server needs to support bindings only for the duration of a
  223. single remote procedure call.
  224.  
  225. This example also demonstrates the use of the shut_down
  226. global variable, which instructs the server control
  227. procedure to shut down (terminate) the server after the
  228. client has called the remote procedure sub().
  229.  
  230. Most of these examples use the non-persistent style of
  231. process binding for simplicity.  See the persist example for
  232. a demonstration of the persistent style of process binding.
  233. A more complete description of process-binding techniques
  234. appears in Chapter 4, "Process Binding," in the NetWare RPC
  235. User's Manual.
  236.